1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 11:51:57 +00:00
srs/trunk/3rdparty/st-srs/md_linux.S

169 lines
4 KiB
ArmAsm
Raw Normal View History

2021-10-02 00:54:53 +00:00
/* SPDX-License-Identifier: MPL-1.1 OR GPL-2.0-or-later */
/* If user disable the ASM, such as avoiding bugs in ASM, donot compile it. */
#if !defined(MD_ST_NO_ASM)
/*
* Portions created by SGI are Copyright (C) 2000 Silicon Graphics, Inc.
* All Rights Reserved.
*/
ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2 commit f4872e528cad07f8ea683cc8cb26e34111bad1b5 Author: winlin <winlin@vip.126.com> Date: Fri Feb 26 09:13:21 2021 +0800 ST: For #2188: Remove sendmmsg from ST. commit aaeb8919bd4a026268e0600398cb1e9ad477663f Author: winlin <winlin@vip.126.com> Date: Thu Mar 11 08:09:54 2021 +0800 ST: Refine utest script. commit d1ac9da53060b6bfa82b5d041da4c2ad9bd6b90a Author: winlin <winlin@vip.126.com> Date: Wed Mar 3 11:02:25 2021 +0800 ST: Support fast utest and coverage commit 8400115b83c022e33f59422dbf6d85ee46fb9edb Author: winlin <winlin@vip.126.com> Date: Fri Feb 26 07:02:19 2021 +0800 ST: Always use unserialized accept for linux or darwin commit c3686f2bca80d2c139239b08975575b1bb981ffa Author: winlin <winlin@vip.126.com> Date: Fri Feb 26 06:54:05 2021 +0800 ST: Refine ARFLAGS by disable the verbose log commit aaa5c4f863eba278c4ed2b29a46297fb01a4ed63 Author: winlin <winlin@vip.126.com> Date: Thu Feb 25 08:58:46 2021 +0800 ST: Stack always grows from top to down. commit dddd466e5c2e418c6f4896cd8bf701130052b3d9 Author: winlin <winlin@vip.126.com> Date: Thu Feb 25 08:51:31 2021 +0800 ST: Ignore process fork, for single process only commit 7906cb5f6e78c916cb8b8d9522275bfc086bb6a3 Author: winlin <winlin@vip.126.com> Date: Thu Feb 25 08:50:59 2021 +0800 ST: Fix build warnings commit d94921b84a3b6cf88ace2c766cc2bfedb9c0602e Author: winlin <winlin@vip.126.com> Date: Thu Feb 25 07:27:45 2021 +0800 ST: Remove select and poll support, only epoll and kqueue commit 76d202514615f78d1a8f2b15778f3dac5abf4abb Author: winlin <winlin@vip.126.com> Date: Thu Feb 25 07:10:47 2021 +0800 ST: Remove multiple OS support, except Linux and Darwin. commit 13c4ba345c61170e86dde486a174378ca235f442 Author: winlin <winlin@vip.126.com> Date: Thu Feb 25 06:59:35 2021 +0800 ST: Remove __ia64__ CPU support commit 46c06e4a11879cfeb828382e44f11287782ce4b5 Author: winlin <winlin@vip.126.com> Date: Wed Feb 24 11:37:27 2021 +0800 ST: Remove unused files for ST
2021-04-26 00:01:49 +00:00
#if defined(__i386__)
/****************************************************************/
/*
* Internal __jmp_buf layout
*/
#define JB_BX 0
#define JB_SI 1
#define JB_DI 2
#define JB_BP 3
#define JB_SP 4
#define JB_PC 5
.file "md.S"
.text
/* _st_md_cxt_save(__jmp_buf env) */
.globl _st_md_cxt_save
.type _st_md_cxt_save, @function
.align 16
_st_md_cxt_save:
movl 4(%esp), %eax
/*
* Save registers.
*/
movl %ebx, (JB_BX*4)(%eax)
movl %esi, (JB_SI*4)(%eax)
movl %edi, (JB_DI*4)(%eax)
/* Save SP */
leal 4(%esp), %ecx
movl %ecx, (JB_SP*4)(%eax)
/* Save PC we are returning to */
movl 0(%esp), %ecx
movl %ecx, (JB_PC*4)(%eax)
/* Save caller frame pointer */
movl %ebp, (JB_BP*4)(%eax)
xorl %eax, %eax
ret
.size _st_md_cxt_save, .-_st_md_cxt_save
/****************************************************************/
/* _st_md_cxt_restore(__jmp_buf env, int val) */
.globl _st_md_cxt_restore
.type _st_md_cxt_restore, @function
.align 16
_st_md_cxt_restore:
/* First argument is jmp_buf */
movl 4(%esp), %ecx
/* Second argument is return value */
movl 8(%esp), %eax
/* Set the return address */
movl (JB_PC*4)(%ecx), %edx
/*
* Restore registers.
*/
movl (JB_BX*4)(%ecx), %ebx
movl (JB_SI*4)(%ecx), %esi
movl (JB_DI*4)(%ecx), %edi
movl (JB_BP*4)(%ecx), %ebp
movl (JB_SP*4)(%ecx), %esp
testl %eax, %eax
jnz 1f
incl %eax
/* Jump to saved PC */
1: jmp *%edx
.size _st_md_cxt_restore, .-_st_md_cxt_restore
/****************************************************************/
#elif defined(__amd64__) || defined(__x86_64__)
/****************************************************************/
/*
* Internal __jmp_buf layout
*/
#define JB_RBX 0
#define JB_RBP 1
#define JB_R12 2
#define JB_R13 3
#define JB_R14 4
#define JB_R15 5
#define JB_RSP 6
#define JB_PC 7
.file "md.S"
.text
/* _st_md_cxt_save(__jmp_buf env) */
.globl _st_md_cxt_save
.type _st_md_cxt_save, @function
.align 16
_st_md_cxt_save:
/*
* Save registers.
*/
movq %rbx, (JB_RBX*8)(%rdi)
movq %rbp, (JB_RBP*8)(%rdi)
movq %r12, (JB_R12*8)(%rdi)
movq %r13, (JB_R13*8)(%rdi)
movq %r14, (JB_R14*8)(%rdi)
movq %r15, (JB_R15*8)(%rdi)
/* Save SP */
leaq 8(%rsp), %rdx
movq %rdx, (JB_RSP*8)(%rdi)
/* Save PC we are returning to */
movq (%rsp), %rax
movq %rax, (JB_PC*8)(%rdi)
xorq %rax, %rax
ret
.size _st_md_cxt_save, .-_st_md_cxt_save
/****************************************************************/
/* _st_md_cxt_restore(__jmp_buf env, int val) */
.globl _st_md_cxt_restore
.type _st_md_cxt_restore, @function
.align 16
_st_md_cxt_restore:
/*
* Restore registers.
*/
movq (JB_RBX*8)(%rdi), %rbx
movq (JB_RBP*8)(%rdi), %rbp
movq (JB_R12*8)(%rdi), %r12
movq (JB_R13*8)(%rdi), %r13
movq (JB_R14*8)(%rdi), %r14
movq (JB_R15*8)(%rdi), %r15
/* Set return value */
test %esi, %esi
mov $01, %eax
cmove %eax, %esi
mov %esi, %eax
movq (JB_PC*8)(%rdi), %rdx
movq (JB_RSP*8)(%rdi), %rsp
/* Jump to saved PC */
jmpq *%rdx
.size _st_md_cxt_restore, .-_st_md_cxt_restore
/****************************************************************/
#endif
#endif