mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
AppleM1: Support Apple Silicon M1(aarch64).
This commit is contained in:
parent
b787656eea
commit
f2fa289fe8
24 changed files with 594 additions and 8 deletions
124
trunk/3rdparty/st-srs/md_darwin.S
vendored
124
trunk/3rdparty/st-srs/md_darwin.S
vendored
|
@ -74,6 +74,128 @@
|
|||
|
||||
/****************************************************************/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#elif defined(__aarch64__)
|
||||
|
||||
/****************************************************************/
|
||||
/* See https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms */
|
||||
/* See https://developer.arm.com/documentation/102374/0100/Function-calls */
|
||||
/* See https://developer.arm.com/documentation/102374/0100/Procedure-Call-Standard */
|
||||
/* See https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#machine-registers */
|
||||
/* See https://wiki.cdot.senecacollege.ca/wiki/AArch64_Register_and_Instruction_Quick_Start */
|
||||
/*
|
||||
* See setjmp.h of Darwin.
|
||||
*
|
||||
* _JBLEN is the number of ints required to save the following:
|
||||
* r21-r29, sp, fp, lr == 12 registers, 8 bytes each. d8-d15
|
||||
* are another 8 registers, each 8 bytes long. (aapcs64 specifies
|
||||
* that only 64-bit versions of FP registers need to be saved).
|
||||
* Finally, two 8-byte fields for signal handling purposes.
|
||||
*/
|
||||
|
||||
/* The called routine is expected to preserve r19-r28 *** These registers are generally
|
||||
safe to use in your program. */
|
||||
#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
|
||||
/* r29 and r30 are used as the frame register and link register (avoid) */
|
||||
#define JB_X29 10
|
||||
#define JB_LR 11
|
||||
/* Register '31' is one of two registers depending on the instruction context:
|
||||
For instructions dealing with the stack, it is the stack pointer, named rsp */
|
||||
#define JB_SP 13
|
||||
|
||||
/* FP registers */
|
||||
#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
|
||||
.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
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
/* _st_md_cxt_restore(__jmp_buf env, int val) */
|
||||
.globl __st_md_cxt_restore
|
||||
.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
|
||||
|
||||
/* x0 = (x1 || 1); */
|
||||
cmp x1, #0
|
||||
mov x0, #1
|
||||
csel x0, x1, x0, ne
|
||||
|
||||
ret
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue