everywhere: rename __setcontext to libucontext_setcontext

pull/21/head
Ariadne Conill 2020-12-06 03:03:07 -06:00
parent 99ed5bbe12
commit 37fe7afd5f
22 changed files with 53 additions and 53 deletions

View File

@ -12,9 +12,9 @@
#include "defs.h" #include "defs.h"
ALIAS(setcontext, __setcontext) ALIAS(setcontext, libucontext_setcontext)
FUNC(__setcontext) FUNC(libucontext_setcontext)
/* restore GPRs */ /* restore GPRs */
ldp x18, x19, [x0, #REG_OFFSET(18)] ldp x18, x19, [x0, #REG_OFFSET(18)]
ldp x20, x21, [x0, #REG_OFFSET(20)] ldp x20, x21, [x0, #REG_OFFSET(20)]
@ -41,4 +41,4 @@ FUNC(__setcontext)
/* jump to new PC */ /* jump to new PC */
br x16 br x16
END(__setcontext) END(libucontext_setcontext)

View File

@ -15,7 +15,7 @@
FUNC(libucontext_trampoline) FUNC(libucontext_trampoline)
/* get the proper context into position and test for NULL */ /* get the proper context into position and test for NULL */
mov x0, x19 mov x0, x19
cbnz x0, __setcontext cbnz x0, libucontext_setcontext
/* something went wrong, exit */ /* something went wrong, exit */
b exit b exit

View File

@ -50,7 +50,7 @@ FUNC(__swapcontext)
/* move x1 to x0 and call setcontext */ /* move x1 to x0 and call setcontext */
mov x0, x1 mov x0, x1
bl __setcontext bl libucontext_setcontext
/* hmm, we came back here try to return */ /* hmm, we came back here try to return */
mov x30, x28 mov x30, x28

View File

@ -12,9 +12,9 @@
#include "defs.h" #include "defs.h"
ALIAS(setcontext, __setcontext) ALIAS(setcontext, libucontext_setcontext)
FUNC(__setcontext) FUNC(libucontext_setcontext)
/* copy all of the current registers into the ucontext structure */ /* copy all of the current registers into the ucontext structure */
add r14, r0, #REG_OFFSET(0) add r14, r0, #REG_OFFSET(0)
ldmia r14, {r0-r12} ldmia r14, {r0-r12}
@ -23,4 +23,4 @@ FUNC(__setcontext)
/* load link register and jump to new context */ /* load link register and jump to new context */
ldmia r14, {r14, pc} ldmia r14, {r14, pc}
END(__setcontext) END(libucontext_setcontext)

View File

@ -17,7 +17,7 @@
libucontext_trampoline: libucontext_trampoline:
/* get the proper context into position and test for NULL */ /* get the proper context into position and test for NULL */
movs r0, r4 movs r0, r4
bne __setcontext@plt bne libucontext_setcontext@plt
/* we are returning into a null context, it seems, so maybe we should exit */ /* we are returning into a null context, it seems, so maybe we should exit */
b exit@plt b exit@plt

View File

@ -12,9 +12,9 @@
#include "defs.h" #include "defs.h"
ALIAS(setcontext, __setcontext) ALIAS(setcontext, libucontext_setcontext)
FUNC(__setcontext) FUNC(libucontext_setcontext)
move.l 4(%sp), %a0 /* load ucontext_t pointer from stack */ move.l 4(%sp), %a0 /* load ucontext_t pointer from stack */
move.l REG_OFFSET(REG_SP)(%a0), %sp /* load new stack pointer */ move.l REG_OFFSET(REG_SP)(%a0), %sp /* load new stack pointer */
@ -27,4 +27,4 @@ FUNC(__setcontext)
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(__setcontext) END(libucontext_setcontext)

View File

@ -18,7 +18,7 @@ FUNC(libucontext_trampoline)
tst.l (%sp) /* test next content for NULL */ tst.l (%sp) /* test next content for NULL */
jeq no_linked_context jeq no_linked_context
jbsr __setcontext /* call setcontext */ jbsr libucontext_setcontext /* call setcontext */
move.l %d0, (%sp) move.l %d0, (%sp)
no_linked_context: no_linked_context:

View File

@ -14,10 +14,10 @@ LOCALSZ = 1
#include "defs.h" #include "defs.h"
ALIAS(setcontext, __setcontext) ALIAS(setcontext, libucontext_setcontext)
FUNC(__setcontext) FUNC(libucontext_setcontext)
PUSH_FRAME(__setcontext) PUSH_FRAME(libucontext_setcontext)
/* move the context to $v0 */ /* move the context to $v0 */
move $v0, $a0 move $v0, $a0
@ -46,5 +46,5 @@ FUNC(__setcontext)
move $v0, $zero move $v0, $zero
jr $t9 jr $t9
POP_FRAME(__setcontext) POP_FRAME(libucontext_setcontext)
END(__setcontext) END(libucontext_setcontext)

View File

@ -22,7 +22,7 @@ FUNC(libucontext_trampoline)
/* call setcontext */ /* call setcontext */
move $a0, $s0 move $a0, $s0
la $t9, __setcontext la $t9, libucontext_setcontext
jr $t9 jr $t9

View File

@ -14,10 +14,10 @@ LOCALSZ = 1
#include "defs.h" #include "defs.h"
ALIAS(setcontext, __setcontext) ALIAS(setcontext, libucontext_setcontext)
FUNC(__setcontext) FUNC(libucontext_setcontext)
PUSH_FRAME(__setcontext) PUSH_FRAME(libucontext_setcontext)
/* move the context to $v0 */ /* move the context to $v0 */
move $v0, $a0 move $v0, $a0
@ -50,5 +50,5 @@ FUNC(__setcontext)
move $v0, $zero move $v0, $zero
jr $t9 jr $t9
POP_FRAME(__setcontext) POP_FRAME(libucontext_setcontext)
END(__setcontext) END(libucontext_setcontext)

View File

@ -22,7 +22,7 @@ FUNC(libucontext_trampoline)
/* call setcontext */ /* call setcontext */
move $a0, $s0 move $a0, $s0
dla $t9, __setcontext dla $t9, libucontext_setcontext
jr $t9 jr $t9

View File

@ -10,12 +10,12 @@
* from the use of this software. * from the use of this software.
*/ */
.global __setcontext .global libucontext_setcontext
.hidden __swapcontext .hidden __swapcontext
__setcontext: libucontext_setcontext:
mr 4, 3 mr 4, 3
li 3, 0 li 3, 0
b __swapcontext@local b __swapcontext@local
.weak setcontext .weak setcontext
setcontext = __setcontext setcontext = libucontext_setcontext

View File

@ -19,7 +19,7 @@ libucontext_trampoline:
beq no_linked_context beq no_linked_context
/* jump to setcontext */ /* jump to setcontext */
bl __setcontext@local bl libucontext_setcontext@local
no_linked_context: no_linked_context:
b exit@GOT b exit@GOT

View File

@ -10,17 +10,17 @@
* from the use of this software. * from the use of this software.
*/ */
.global __setcontext .global libucontext_setcontext
.hidden __swapcontext .hidden __swapcontext
__setcontext: libucontext_setcontext:
addis 2, 12, .TOC.-__setcontext@ha addis 2, 12, .TOC.-libucontext_setcontext@ha
addi 2, 12, .TOC.-__setcontext@l addi 2, 12, .TOC.-libucontext_setcontext@l
.localentry __setcontext,.-__setcontext .localentry libucontext_setcontext,.-libucontext_setcontext
mr 4, 3 mr 4, 3
li 3, 0 li 3, 0
b __swapcontext b __swapcontext
.weak setcontext .weak setcontext
setcontext = __setcontext setcontext = libucontext_setcontext

View File

@ -12,9 +12,9 @@
#include "defs.h" #include "defs.h"
ALIAS(setcontext, __setcontext) ALIAS(setcontext, libucontext_setcontext)
FUNC(__setcontext) FUNC(libucontext_setcontext)
/* move $a0 to $t0 to avoid clobbering. */ /* move $a0 to $t0 to avoid clobbering. */
mv t0, a0 mv t0, a0
@ -52,4 +52,4 @@ FUNC(__setcontext)
/* done saving, return */ /* done saving, return */
ret ret
END(__setcontext) END(libucontext_setcontext)

View File

@ -21,7 +21,7 @@ FUNC(libucontext_trampoline)
/* if one is set, invoke it */ /* if one is set, invoke it */
mv a0, s2 mv a0, s2
jal __setcontext jal libucontext_setcontext
/* otherwise, exit. */ /* otherwise, exit. */
no_linked_context: no_linked_context:

View File

@ -22,7 +22,7 @@
extern void libucontext_trampoline(void); extern void libucontext_trampoline(void);
extern int __setcontext(const ucontext_t *ucp); extern int libucontext_setcontext(const ucontext_t *ucp);
void void
@ -37,7 +37,7 @@ libucontext_makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
ucp->uc_mcontext.gregs[7] = (uintptr_t) func; ucp->uc_mcontext.gregs[7] = (uintptr_t) func;
ucp->uc_mcontext.gregs[8] = (uintptr_t) ucp->uc_link; ucp->uc_mcontext.gregs[8] = (uintptr_t) ucp->uc_link;
ucp->uc_mcontext.gregs[9] = (uintptr_t) &__setcontext; ucp->uc_mcontext.gregs[9] = (uintptr_t) &libucontext_setcontext;
ucp->uc_mcontext.gregs[14] = (uintptr_t) &libucontext_trampoline; ucp->uc_mcontext.gregs[14] = (uintptr_t) &libucontext_trampoline;
va_start(va, argc); va_start(va, argc);

View File

@ -12,13 +12,13 @@
#include "defs.h" #include "defs.h"
ALIAS(setcontext, __setcontext) ALIAS(setcontext, libucontext_setcontext)
FUNC(__setcontext) FUNC(libucontext_setcontext)
lgr %r1, %r2 /* use %r1 as our working register */ lgr %r1, %r2 /* use %r1 as our working register */
lam %a2, %a15, AREG_OFFSET(2)(%r1) /* load access registers, but skip %a0 and %a1 which are for TLS */ lam %a2, %a15, AREG_OFFSET(2)(%r1) /* load access registers, but skip %a0 and %a1 which are for TLS */
lmg %r0, %r15, REG_OFFSET(0)(%r1) /* store general-purpose registers */ lmg %r0, %r15, REG_OFFSET(0)(%r1) /* store general-purpose registers */
br %r14 /* return to new link register address */ br %r14 /* return to new link register address */
END(__setcontext) END(libucontext_setcontext)

View File

@ -12,9 +12,9 @@
#include "defs.h" #include "defs.h"
ALIAS(setcontext, __setcontext) ALIAS(setcontext, libucontext_setcontext)
FUNC(__setcontext) FUNC(libucontext_setcontext)
/* load address of the ucontext structure */ /* load address of the ucontext structure */
movl 4(%esp), %eax movl 4(%esp), %eax
@ -41,4 +41,4 @@ FUNC(__setcontext)
movl REG_OFFSET(REG_EAX)(%eax), %eax movl REG_OFFSET(REG_EAX)(%eax), %eax
ret ret
END(__setcontext) END(libucontext_setcontext)

View File

@ -17,7 +17,7 @@ FUNC(libucontext_trampoline)
leal (%esp,%ebx,4), %esp leal (%esp,%ebx,4), %esp
cmpl $0, (%esp) cmpl $0, (%esp)
/* restore global offset table, exit@plt and __setcontext@plt need this */ /* restore global offset table, exit@plt and libucontext_setcontext@plt need this */
call __i686.get_pc_thunk.bx call __i686.get_pc_thunk.bx
addl $_GLOBAL_OFFSET_TABLE_, %ebx addl $_GLOBAL_OFFSET_TABLE_, %ebx
@ -25,7 +25,7 @@ FUNC(libucontext_trampoline)
je no_linked_context je no_linked_context
/* call setcontext to switch to the linked context */ /* call setcontext to switch to the linked context */
call __setcontext@plt call libucontext_setcontext@plt
movl %eax, (%esp) movl %eax, (%esp)
no_linked_context: no_linked_context:

View File

@ -12,9 +12,9 @@
#include "defs.h" #include "defs.h"
ALIAS(setcontext, __setcontext) ALIAS(setcontext, libucontext_setcontext)
FUNC(__setcontext) FUNC(libucontext_setcontext)
/* set all of the registers */ /* set all of the registers */
movq REG_OFFSET(REG_R8)(%rdi), %r8 movq REG_OFFSET(REG_R8)(%rdi), %r8
movq REG_OFFSET(REG_R9)(%rdi), %r9 movq REG_OFFSET(REG_R9)(%rdi), %r9
@ -42,4 +42,4 @@ FUNC(__setcontext)
/* we're all done here, return 0 */ /* we're all done here, return 0 */
xorl %eax, %eax xorl %eax, %eax
ret ret
END(__setcontext) END(libucontext_setcontext)

View File

@ -22,7 +22,7 @@ FUNC(libucontext_trampoline)
je no_linked_context je no_linked_context
/* call setcontext to switch to the linked context */ /* call setcontext to switch to the linked context */
call __setcontext@plt call libucontext_setcontext@plt
movq %rax, %rdi movq %rax, %rdi
no_linked_context: no_linked_context: