forked from ariadne/libucontext
everywhere: rename __swapcontext to libucontext_swapcontext
parent
37fe7afd5f
commit
e65e485630
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
ALIAS(swapcontext, __swapcontext)
|
ALIAS(swapcontext, libucontext_swapcontext)
|
||||||
|
|
||||||
FUNC(__swapcontext)
|
FUNC(libucontext_swapcontext)
|
||||||
str xzr, [x0, #REG_OFFSET(0)]
|
str xzr, [x0, #REG_OFFSET(0)]
|
||||||
|
|
||||||
/* save GPRs */
|
/* save GPRs */
|
||||||
|
@ -55,4 +55,4 @@ FUNC(__swapcontext)
|
||||||
/* hmm, we came back here try to return */
|
/* hmm, we came back here try to return */
|
||||||
mov x30, x28
|
mov x30, x28
|
||||||
ret
|
ret
|
||||||
END(__swapcontext)
|
END(libucontext_swapcontext)
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
ALIAS(swapcontext, __swapcontext)
|
ALIAS(swapcontext, libucontext_swapcontext)
|
||||||
|
|
||||||
FUNC(__swapcontext)
|
FUNC(libucontext_swapcontext)
|
||||||
/* copy all of the current registers into the ucontext structure */
|
/* copy all of the current registers into the ucontext structure */
|
||||||
add r2, r0, #REG_OFFSET(0)
|
add r2, r0, #REG_OFFSET(0)
|
||||||
stmia r2, {r0-r12}
|
stmia r2, {r0-r12}
|
||||||
|
@ -27,4 +27,4 @@ FUNC(__swapcontext)
|
||||||
ldr r13, [r14, #52]
|
ldr r13, [r14, #52]
|
||||||
add r14, r14, #56
|
add r14, r14, #56
|
||||||
ldmia r14, {r14, pc}
|
ldmia r14, {r14, pc}
|
||||||
END(__swapcontext)
|
END(libucontext_swapcontext)
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
ALIAS(swapcontext, __swapcontext)
|
ALIAS(swapcontext, libucontext_swapcontext)
|
||||||
|
|
||||||
FUNC(__swapcontext)
|
FUNC(libucontext_swapcontext)
|
||||||
move.l 4(%sp), %a0 /* load save ucontext_t pointer from stack */
|
move.l 4(%sp), %a0 /* load save ucontext_t pointer from stack */
|
||||||
|
|
||||||
movem.l %d2-%d7, REG_OFFSET(REG_D2)(%a0) /* preserve $d2 through $d7 */
|
movem.l %d2-%d7, REG_OFFSET(REG_D2)(%a0) /* preserve $d2 through $d7 */
|
||||||
|
@ -36,4 +36,4 @@ FUNC(__swapcontext)
|
||||||
move.l REG_OFFSET(REG_PC)(%a0), %a1 /* load jump target */
|
move.l REG_OFFSET(REG_PC)(%a0), %a1 /* load jump target */
|
||||||
|
|
||||||
jmp (%a1) /* jump to *$a1 */
|
jmp (%a1) /* jump to *$a1 */
|
||||||
END(__swapcontext)
|
END(libucontext_swapcontext)
|
||||||
|
|
|
@ -16,14 +16,14 @@ LOCALSZ = 2
|
||||||
|
|
||||||
A1_OFFSET = FRAMESZ - (1 * REG_SZ)
|
A1_OFFSET = FRAMESZ - (1 * REG_SZ)
|
||||||
|
|
||||||
ALIAS(swapcontext, __swapcontext)
|
ALIAS(swapcontext, libucontext_swapcontext)
|
||||||
|
|
||||||
FUNC(__swapcontext)
|
FUNC(libucontext_swapcontext)
|
||||||
/* copy $gp, $sp, $fp to temporary registers so we don't clobber them */
|
/* copy $gp, $sp, $fp to temporary registers so we don't clobber them */
|
||||||
move $a2, $gp
|
move $a2, $gp
|
||||||
move $a3, $sp
|
move $a3, $sp
|
||||||
|
|
||||||
PUSH_FRAME(__swapcontext)
|
PUSH_FRAME(libucontext_swapcontext)
|
||||||
|
|
||||||
/* set registers */
|
/* set registers */
|
||||||
sd $s0, REG_OFFSET(16)($a0)
|
sd $s0, REG_OFFSET(16)($a0)
|
||||||
|
@ -74,8 +74,8 @@ FUNC(__swapcontext)
|
||||||
fail:
|
fail:
|
||||||
la $t9, exit
|
la $t9, exit
|
||||||
|
|
||||||
POP_FRAME(__swapcontext)
|
POP_FRAME(libucontext_swapcontext)
|
||||||
|
|
||||||
move $v0, $zero
|
move $v0, $zero
|
||||||
jalr $t9
|
jalr $t9
|
||||||
END(__swapcontext)
|
END(libucontext_swapcontext)
|
||||||
|
|
|
@ -16,15 +16,15 @@ LOCALSZ = 2
|
||||||
|
|
||||||
A1_OFFSET = FRAMESZ - (1 * REG_SZ)
|
A1_OFFSET = FRAMESZ - (1 * REG_SZ)
|
||||||
|
|
||||||
ALIAS(swapcontext, __swapcontext)
|
ALIAS(swapcontext, libucontext_swapcontext)
|
||||||
|
|
||||||
FUNC(__swapcontext)
|
FUNC(libucontext_swapcontext)
|
||||||
/* copy $gp, $sp, $fp to temporary registers so we don't clobber them */
|
/* copy $gp, $sp, $fp to temporary registers so we don't clobber them */
|
||||||
move $a2, $gp
|
move $a2, $gp
|
||||||
move $a3, $sp
|
move $a3, $sp
|
||||||
move $a4, $fp
|
move $a4, $fp
|
||||||
|
|
||||||
PUSH_FRAME(__swapcontext)
|
PUSH_FRAME(libucontext_swapcontext)
|
||||||
|
|
||||||
/* set registers */
|
/* set registers */
|
||||||
sd $s0, REG_OFFSET(16)($a0)
|
sd $s0, REG_OFFSET(16)($a0)
|
||||||
|
@ -79,8 +79,8 @@ FUNC(__swapcontext)
|
||||||
fail:
|
fail:
|
||||||
dla $t9, exit
|
dla $t9, exit
|
||||||
|
|
||||||
POP_FRAME(__swapcontext)
|
POP_FRAME(libucontext_swapcontext)
|
||||||
|
|
||||||
move $v0, $zero
|
move $v0, $zero
|
||||||
jalr $t9
|
jalr $t9
|
||||||
END(__swapcontext)
|
END(libucontext_swapcontext)
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.global libucontext_getcontext
|
.global libucontext_getcontext
|
||||||
.hidden __swapcontext
|
.hidden libucontext_swapcontext
|
||||||
libucontext_getcontext:
|
libucontext_getcontext:
|
||||||
li 4, 0
|
li 4, 0
|
||||||
b __swapcontext@local
|
b libucontext_swapcontext@local
|
||||||
|
|
||||||
.weak getcontext
|
.weak getcontext
|
||||||
getcontext = libucontext_getcontext
|
getcontext = libucontext_getcontext
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.global libucontext_setcontext
|
.global libucontext_setcontext
|
||||||
.hidden __swapcontext
|
.hidden libucontext_swapcontext
|
||||||
libucontext_setcontext:
|
libucontext_setcontext:
|
||||||
mr 4, 3
|
mr 4, 3
|
||||||
li 3, 0
|
li 3, 0
|
||||||
b __swapcontext@local
|
b libucontext_swapcontext@local
|
||||||
|
|
||||||
.weak setcontext
|
.weak setcontext
|
||||||
setcontext = libucontext_setcontext
|
setcontext = libucontext_setcontext
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
* from the use of this software.
|
* from the use of this software.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.global __swapcontext
|
.global libucontext_swapcontext
|
||||||
__swapcontext:
|
libucontext_swapcontext:
|
||||||
li 0, 249 # SYS_swapcontext
|
li 0, 249 # SYS_swapcontext
|
||||||
li 5, 1184 # sizeof(ucontext_t)
|
li 5, 1184 # sizeof(ucontext_t)
|
||||||
sc
|
sc
|
||||||
|
@ -20,4 +20,4 @@ __swapcontext:
|
||||||
b __retfromsyscall@local
|
b __retfromsyscall@local
|
||||||
|
|
||||||
.weak swapcontext
|
.weak swapcontext
|
||||||
swapcontext = __swapcontext
|
swapcontext = libucontext_swapcontext
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.global libucontext_getcontext
|
.global libucontext_getcontext
|
||||||
.hidden __swapcontext
|
.hidden libucontext_swapcontext
|
||||||
libucontext_getcontext:
|
libucontext_getcontext:
|
||||||
addis 2, 12, .TOC.-libucontext_getcontext@ha
|
addis 2, 12, .TOC.-libucontext_getcontext@ha
|
||||||
addi 2, 12, .TOC.-libucontext_getcontext@l
|
addi 2, 12, .TOC.-libucontext_getcontext@l
|
||||||
|
@ -19,7 +19,7 @@ libucontext_getcontext:
|
||||||
.localentry libucontext_getcontext,.-libucontext_getcontext
|
.localentry libucontext_getcontext,.-libucontext_getcontext
|
||||||
|
|
||||||
li 4, 0
|
li 4, 0
|
||||||
b __swapcontext
|
b libucontext_swapcontext
|
||||||
|
|
||||||
.weak getcontext
|
.weak getcontext
|
||||||
getcontext = libucontext_getcontext
|
getcontext = libucontext_getcontext
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.global libucontext_setcontext
|
.global libucontext_setcontext
|
||||||
.hidden __swapcontext
|
.hidden libucontext_swapcontext
|
||||||
libucontext_setcontext:
|
libucontext_setcontext:
|
||||||
addis 2, 12, .TOC.-libucontext_setcontext@ha
|
addis 2, 12, .TOC.-libucontext_setcontext@ha
|
||||||
addi 2, 12, .TOC.-libucontext_setcontext@l
|
addi 2, 12, .TOC.-libucontext_setcontext@l
|
||||||
|
@ -20,7 +20,7 @@ libucontext_setcontext:
|
||||||
|
|
||||||
mr 4, 3
|
mr 4, 3
|
||||||
li 3, 0
|
li 3, 0
|
||||||
b __swapcontext
|
b libucontext_swapcontext
|
||||||
|
|
||||||
.weak setcontext
|
.weak setcontext
|
||||||
setcontext = libucontext_setcontext
|
setcontext = libucontext_setcontext
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
* from the use of this software.
|
* from the use of this software.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.global __swapcontext
|
.global libucontext_swapcontext
|
||||||
__swapcontext:
|
libucontext_swapcontext:
|
||||||
addis 2, 12, .TOC.-__swapcontext@ha
|
addis 2, 12, .TOC.-libucontext_swapcontext@ha
|
||||||
addi 2, 12, .TOC.-__swapcontext@l
|
addi 2, 12, .TOC.-libucontext_swapcontext@l
|
||||||
|
|
||||||
.localentry __swapcontext,.-__swapcontext
|
.localentry libucontext_swapcontext,.-libucontext_swapcontext
|
||||||
|
|
||||||
li 0, 249 # SYS_swapcontext
|
li 0, 249 # SYS_swapcontext
|
||||||
li 5, 1696 # sizeof(ucontext_t)
|
li 5, 1696 # sizeof(ucontext_t)
|
||||||
|
@ -25,4 +25,4 @@ __swapcontext:
|
||||||
b __retfromsyscall
|
b __retfromsyscall
|
||||||
|
|
||||||
.weak swapcontext
|
.weak swapcontext
|
||||||
swapcontext = __swapcontext
|
swapcontext = libucontext_swapcontext
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
ALIAS(swapcontext, __swapcontext)
|
ALIAS(swapcontext, libucontext_swapcontext)
|
||||||
|
|
||||||
FUNC(__swapcontext)
|
FUNC(libucontext_swapcontext)
|
||||||
/* move $a1 to $t0 to avoid clobbering. */
|
/* move $a1 to $t0 to avoid clobbering. */
|
||||||
mv t0, a1
|
mv t0, a1
|
||||||
|
|
||||||
|
@ -77,4 +77,4 @@ FUNC(__swapcontext)
|
||||||
|
|
||||||
/* done swapping, return */
|
/* done swapping, return */
|
||||||
ret
|
ret
|
||||||
END(__swapcontext)
|
END(libucontext_swapcontext)
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
ALIAS(swapcontext, __swapcontext)
|
ALIAS(swapcontext, libucontext_swapcontext)
|
||||||
|
|
||||||
FUNC(__swapcontext)
|
FUNC(libucontext_swapcontext)
|
||||||
lgr %r1, %r2 /* use %r1 to save current context to */
|
lgr %r1, %r2 /* use %r1 to save current context to */
|
||||||
lgr %r0, %r3 /* use %r0 for source context */
|
lgr %r0, %r3 /* use %r0 for source context */
|
||||||
|
|
||||||
|
@ -26,4 +26,4 @@ FUNC(__swapcontext)
|
||||||
lmg %r0, %r15, REG_OFFSET(0)(%r2) /* load general-purpose registers */
|
lmg %r0, %r15, REG_OFFSET(0)(%r2) /* load general-purpose registers */
|
||||||
|
|
||||||
br %r14 /* return to new link register address */
|
br %r14 /* return to new link register address */
|
||||||
END(__swapcontext)
|
END(libucontext_swapcontext)
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
ALIAS(swapcontext, __swapcontext)
|
ALIAS(swapcontext, libucontext_swapcontext)
|
||||||
|
|
||||||
FUNC(__swapcontext)
|
FUNC(libucontext_swapcontext)
|
||||||
/* load address of the ucontext structure */
|
/* load address of the ucontext structure */
|
||||||
movl 4(%esp), %eax
|
movl 4(%esp), %eax
|
||||||
|
|
||||||
|
@ -69,4 +69,4 @@ FUNC(__swapcontext)
|
||||||
movl REG_OFFSET(REG_EAX)(%eax), %eax
|
movl REG_OFFSET(REG_EAX)(%eax), %eax
|
||||||
|
|
||||||
ret
|
ret
|
||||||
END(__swapcontext)
|
END(libucontext_swapcontext)
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
ALIAS(swapcontext, __swapcontext)
|
ALIAS(swapcontext, libucontext_swapcontext)
|
||||||
|
|
||||||
FUNC(__swapcontext)
|
FUNC(libucontext_swapcontext)
|
||||||
/* copy all of the current registers into the ucontext structure pointed by
|
/* copy all of the current registers into the ucontext structure pointed by
|
||||||
the first argument */
|
the first argument */
|
||||||
movq %r8, REG_OFFSET(REG_R8)(%rdi)
|
movq %r8, REG_OFFSET(REG_R8)(%rdi)
|
||||||
|
@ -71,4 +71,4 @@ FUNC(__swapcontext)
|
||||||
/* we're all done here, return 0 */
|
/* we're all done here, return 0 */
|
||||||
xorl %eax, %eax
|
xorl %eax, %eax
|
||||||
ret
|
ret
|
||||||
END(__swapcontext)
|
END(libucontext_swapcontext)
|
||||||
|
|
Loading…
Reference in New Issue