1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-12 11:21:52 +00:00

For #1537, support aarch64 for armv8. 3.0.84

This commit is contained in:
winlin 2019-12-25 19:44:33 +08:00
parent 0e0889af02
commit ea8111cff5
4 changed files with 106 additions and 5 deletions

View file

@ -146,6 +146,7 @@ For previous versions, please read:
## V3 changes
* v3.0, 2019-12-25, For [#1537][bug #1537], support aarch64 for armv8. 3.0.84
* v3.0, 2019-12-25, For [#1538][bug #1538], fresh chunk allow fmt=0 or fmt=1. 3.0.83
* v3.0, 2019-12-25, Remove FFMPEG and NGINX, please use [srs-docker](https://github.com/ossrs/srs-docker) instead. 3.0.82
* v3.0, 2019-12-25, For [#1537][bug #1537], remove cross-build, not used patches, directly build st.

View file

@ -463,6 +463,100 @@
#elif defined(__aarch64__)
/****************************************************************/
#define JB_X19 0
#define JB_X20 1
#define JB_X21 2
#define JB_X22 3
#define JB_X23 4
#define JB_X24 5
#define JB_X25 6
#define JB_X26 7
#define JB_X27 8
#define JB_X28 9
#define JB_X29 10
#define JB_LR 11
#define JB_SP 13
#define JB_D8 14
#define JB_D9 15
#define JB_D10 16
#define JB_D11 17
#define JB_D12 18
#define JB_D13 19
#define JB_D14 20
#define JB_D15 21
.file "md.S"
.text
/* _st_md_cxt_save(__jmp_buf env) */
.globl _st_md_cxt_save
.type _st_md_cxt_save, %function
.align 4
_st_md_cxt_save:
stp x19, x20, [x0, #JB_X19<<3]
stp x21, x22, [x0, #JB_X21<<3]
stp x23, x24, [x0, #JB_X23<<3]
stp x25, x26, [x0, #JB_X25<<3]
stp x27, x28, [x0, #JB_X27<<3]
stp x29, x30, [x0, #JB_X29<<3]
stp d8, d9, [x0, #JB_D8<<3]
stp d10, d11, [x0, #JB_D10<<3]
stp d12, d13, [x0, #JB_D12<<3]
stp d14, d15, [x0, #JB_D14<<3]
mov x2, sp
str x2, [x0, #JB_SP<<3]
mov x0, #0
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 4
_st_md_cxt_restore:
ldp x19, x20, [x0, #JB_X19<<3]
ldp x21, x22, [x0, #JB_X21<<3]
ldp x23, x24, [x0, #JB_X23<<3]
ldp x25, x26, [x0, #JB_X25<<3]
ldp x27, x28, [x0, #JB_X27<<3]
ldp x29, x30, [x0, #JB_X29<<3]
ldp d8, d9, [x0, #JB_D8<<3]
ldp d10, d11, [x0, #JB_D10<<3]
ldp d12, d13, [x0, #JB_D12<<3]
ldp d14, d15, [x0, #JB_D14<<3]
ldr x5, [x0, #JB_SP<<3]
mov sp, x5
cmp x1, #0
mov x0, #1
csel x0, x1, x0, ne
/* Use br instead of ret because ret is guaranteed to mispredict */
br x30
.size _st_md_cxt_restore, .-_st_md_cxt_restore
/****************************************************************/
#elif defined(__arm__)
/****************************************************************/
@ -486,7 +580,7 @@
.size _st_md_cxt_save, .-_st_md_cxt_save
/****************************************************************/
.globl _st_md_cxt_restore
.type _st_md_cxt_restore, %function
.align 2
@ -495,13 +589,13 @@
movs r0, r1 // r1 -> return value
// The bellow is a group, that is:
// if (r0 == 0) r0 =1;
ITT eq
ITT eq
moveq r0, #1 // long_jmp should never return 0
ldmia ip!, {v1-v6, sl, fp} // restore registers.
ldr sp, [ip], #4 // restore sp, like: sp=*ip; ip+=4;
ldr lr, [ip], #4
bx lr
bx lr
.size _st_md_cxt_restore, .-_st_md_cxt_restore
/****************************************************************/

View file

@ -418,6 +418,12 @@
#endif
#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[JB_RSP]
#elif defined(__aarch64__)
/* https://github.com/ossrs/state-threads/issues/9 */
#define MD_STACK_GROWS_DOWN
#define MD_USE_BUILTIN_SETJMP
#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[13]
#elif defined(__arm__)
#define MD_STACK_GROWS_DOWN
/* https://github.com/ossrs/state-threads/issues/1#issuecomment-244648573 */

View file

@ -27,7 +27,7 @@
// The version config.
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 83
#define VERSION_REVISION 84
// The macros generated by configure script.
#include <srs_auto_headers.hpp>