everywhere: rename __start_context to better descriptive libucontext_trampoline
parent
c693dc663c
commit
2f31efaa95
|
@ -20,7 +20,7 @@
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
|
|
||||||
extern void __start_context(void);
|
extern void libucontext_trampoline(void);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -38,7 +38,7 @@ libucontext_makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||||
ucp->uc_mcontext.sp = (uintptr_t) sp;
|
ucp->uc_mcontext.sp = (uintptr_t) sp;
|
||||||
ucp->uc_mcontext.pc = (uintptr_t) func;
|
ucp->uc_mcontext.pc = (uintptr_t) func;
|
||||||
ucp->uc_mcontext.regs[19] = (uintptr_t) ucp->uc_link;
|
ucp->uc_mcontext.regs[19] = (uintptr_t) ucp->uc_link;
|
||||||
ucp->uc_mcontext.regs[30] = (uintptr_t) &__start_context;
|
ucp->uc_mcontext.regs[30] = (uintptr_t) &libucontext_trampoline;
|
||||||
|
|
||||||
va_start(va, argc);
|
va_start(va, argc);
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
FUNC(__start_context)
|
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, __setcontext
|
||||||
|
|
||||||
/* something went wrong, exit */
|
/* something went wrong, exit */
|
||||||
b exit
|
b exit
|
||||||
END(__start_context)
|
END(libucontext_trampoline)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
|
|
||||||
extern void __start_context(void);
|
extern void libucontext_trampoline(void);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -42,7 +42,7 @@ libucontext_makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||||
ucp->uc_mcontext.arm_sp = (uintptr_t) sp;
|
ucp->uc_mcontext.arm_sp = (uintptr_t) sp;
|
||||||
ucp->uc_mcontext.arm_pc = (uintptr_t) func;
|
ucp->uc_mcontext.arm_pc = (uintptr_t) func;
|
||||||
ucp->uc_mcontext.arm_r4 = (uintptr_t) ucp->uc_link;
|
ucp->uc_mcontext.arm_r4 = (uintptr_t) ucp->uc_link;
|
||||||
ucp->uc_mcontext.arm_lr = (uintptr_t) &__start_context;
|
ucp->uc_mcontext.arm_lr = (uintptr_t) &libucontext_trampoline;
|
||||||
|
|
||||||
va_start(va, argc);
|
va_start(va, argc);
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,11 @@
|
||||||
* from the use of this software.
|
* from the use of this software.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.globl __start_context;
|
.globl libucontext_trampoline;
|
||||||
.fnstart
|
.fnstart
|
||||||
.cantunwind
|
.cantunwind
|
||||||
nop
|
nop
|
||||||
__start_context:
|
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 __setcontext@plt
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
|
|
||||||
extern void __start_context(void);
|
extern void libucontext_trampoline(void);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -42,7 +42,7 @@ libucontext_makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||||
ucp->uc_mcontext.gregs[REG_PC] = (greg_t) func;
|
ucp->uc_mcontext.gregs[REG_PC] = (greg_t) func;
|
||||||
|
|
||||||
/* return address */
|
/* return address */
|
||||||
*sp++ = (greg_t) __start_context;
|
*sp++ = (greg_t) libucontext_trampoline;
|
||||||
|
|
||||||
va_start(va, argc);
|
va_start(va, argc);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
FUNC(__start_context)
|
FUNC(libucontext_trampoline)
|
||||||
lea (%sp, %d7.l * REG_SZ), %sp /* place uc_link in $sp */
|
lea (%sp, %d7.l * REG_SZ), %sp /* place uc_link in $sp */
|
||||||
|
|
||||||
tst.l (%sp) /* test next content for NULL */
|
tst.l (%sp) /* test next content for NULL */
|
||||||
|
@ -23,4 +23,4 @@ FUNC(__start_context)
|
||||||
|
|
||||||
no_linked_context:
|
no_linked_context:
|
||||||
jbsr exit
|
jbsr exit
|
||||||
END(__start_context)
|
END(libucontext_trampoline)
|
||||||
|
|
|
@ -76,7 +76,7 @@ no_more_arguments:
|
||||||
addiu $t0, -(4 * REG_SZ)
|
addiu $t0, -(4 * REG_SZ)
|
||||||
|
|
||||||
/* trampoline setup. */
|
/* trampoline setup. */
|
||||||
la $t9, __start_context
|
la $t9, libucontext_trampoline
|
||||||
|
|
||||||
/* copy link pointer as $s0... */
|
/* copy link pointer as $s0... */
|
||||||
lw $v1, UCONTEXT_UC_LINK($a0)
|
lw $v1, UCONTEXT_UC_LINK($a0)
|
||||||
|
|
|
@ -14,7 +14,7 @@ LOCALSZ = 1
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
FUNC(__start_context)
|
FUNC(libucontext_trampoline)
|
||||||
move $gp, $s1
|
move $gp, $s1
|
||||||
|
|
||||||
/* we receive our initial ucontext in $s0, so if $s0 is nil, bail */
|
/* we receive our initial ucontext in $s0, so if $s0 is nil, bail */
|
||||||
|
@ -31,4 +31,4 @@ no_linked_context:
|
||||||
la $t9, exit
|
la $t9, exit
|
||||||
jalr $t9
|
jalr $t9
|
||||||
nop
|
nop
|
||||||
END(__start_context)
|
END(libucontext_trampoline)
|
||||||
|
|
|
@ -82,7 +82,7 @@ store_stack_arg:
|
||||||
|
|
||||||
no_more_arguments:
|
no_more_arguments:
|
||||||
/* trampoline setup. */
|
/* trampoline setup. */
|
||||||
dla $t9, __start_context
|
dla $t9, libucontext_trampoline
|
||||||
|
|
||||||
/* copy link pointer as $s0... */
|
/* copy link pointer as $s0... */
|
||||||
ld $v1, UCONTEXT_UC_LINK($a0)
|
ld $v1, UCONTEXT_UC_LINK($a0)
|
||||||
|
|
|
@ -14,7 +14,7 @@ LOCALSZ = 1
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
FUNC(__start_context)
|
FUNC(libucontext_trampoline)
|
||||||
move $gp, $s1
|
move $gp, $s1
|
||||||
|
|
||||||
/* we receive our initial ucontext in $s0, so if $s0 is nil, bail */
|
/* we receive our initial ucontext in $s0, so if $s0 is nil, bail */
|
||||||
|
@ -31,4 +31,4 @@ no_linked_context:
|
||||||
dla $t9, exit
|
dla $t9, exit
|
||||||
jalr $t9
|
jalr $t9
|
||||||
nop
|
nop
|
||||||
END(__start_context)
|
END(libucontext_trampoline)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
|
|
||||||
extern void __start_context(void);
|
extern void libucontext_trampoline(void);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -38,7 +38,7 @@ libucontext_makecontext(ucontext_t *ucp, void (*func)(), int argc, ...)
|
||||||
sp = (greg_t *) ((uintptr_t) sp & -16L);
|
sp = (greg_t *) ((uintptr_t) sp & -16L);
|
||||||
|
|
||||||
ucp->uc_mcontext.gregs[REG_NIP] = (uintptr_t) func;
|
ucp->uc_mcontext.gregs[REG_NIP] = (uintptr_t) func;
|
||||||
ucp->uc_mcontext.gregs[REG_LNK] = (uintptr_t) &__start_context;
|
ucp->uc_mcontext.gregs[REG_LNK] = (uintptr_t) &libucontext_trampoline;
|
||||||
ucp->uc_mcontext.gregs[REG_R31] = (uintptr_t) ucp->uc_link;
|
ucp->uc_mcontext.gregs[REG_R31] = (uintptr_t) ucp->uc_link;
|
||||||
ucp->uc_mcontext.gregs[REG_SP] = (uintptr_t) sp;
|
ucp->uc_mcontext.gregs[REG_SP] = (uintptr_t) sp;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
* from the use of this software.
|
* from the use of this software.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.globl __start_context;
|
.globl libucontext_trampoline;
|
||||||
__start_context:
|
libucontext_trampoline:
|
||||||
/* get the proper context into position and test for NULL */
|
/* get the proper context into position and test for NULL */
|
||||||
mr. 3,31
|
mr. 3,31
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
|
|
||||||
extern void __start_context(void);
|
extern void libucontext_trampoline(void);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -38,7 +38,7 @@ libucontext_makecontext(ucontext_t *ucp, void (*func)(), int argc, ...)
|
||||||
sp = (greg_t *) ((uintptr_t) sp & -16L);
|
sp = (greg_t *) ((uintptr_t) sp & -16L);
|
||||||
|
|
||||||
ucp->uc_mcontext.gp_regs[REG_NIP] = (uintptr_t) func;
|
ucp->uc_mcontext.gp_regs[REG_NIP] = (uintptr_t) func;
|
||||||
ucp->uc_mcontext.gp_regs[REG_LNK] = (uintptr_t) &__start_context;
|
ucp->uc_mcontext.gp_regs[REG_LNK] = (uintptr_t) &libucontext_trampoline;
|
||||||
ucp->uc_mcontext.gp_regs[REG_SP] = (uintptr_t) sp;
|
ucp->uc_mcontext.gp_regs[REG_SP] = (uintptr_t) sp;
|
||||||
ucp->uc_mcontext.gp_regs[REG_ENTRY] = (uintptr_t) func;
|
ucp->uc_mcontext.gp_regs[REG_ENTRY] = (uintptr_t) func;
|
||||||
ucp->uc_mcontext.gp_regs[REG_R31] = (uintptr_t) ucp->uc_link;
|
ucp->uc_mcontext.gp_regs[REG_R31] = (uintptr_t) ucp->uc_link;
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
* from the use of this software.
|
* from the use of this software.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.globl __start_context;
|
.globl libucontext_trampoline;
|
||||||
.hidden __start_context;
|
.hidden libucontext_trampoline;
|
||||||
__start_context:
|
libucontext_trampoline:
|
||||||
cmpdi 31,0 /* test if ucontext link pointer is null */
|
cmpdi 31,0 /* test if ucontext link pointer is null */
|
||||||
beq no_linked_context /* if it is, exit */
|
beq no_linked_context /* if it is, exit */
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
|
|
||||||
extern void __start_context(void);
|
extern void libucontext_trampoline(void);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -36,7 +36,7 @@ libucontext_makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||||
sp = (greg_t *) (((uintptr_t) sp & -16L));
|
sp = (greg_t *) (((uintptr_t) sp & -16L));
|
||||||
|
|
||||||
/* set up the ucontext structure */
|
/* set up the ucontext structure */
|
||||||
ucp->uc_mcontext.__gregs[REG_RA] = (greg_t) __start_context;
|
ucp->uc_mcontext.__gregs[REG_RA] = (greg_t) libucontext_trampoline;
|
||||||
ucp->uc_mcontext.__gregs[REG_S0] = 0;
|
ucp->uc_mcontext.__gregs[REG_S0] = 0;
|
||||||
ucp->uc_mcontext.__gregs[REG_S1] = (greg_t) func;
|
ucp->uc_mcontext.__gregs[REG_S1] = (greg_t) func;
|
||||||
ucp->uc_mcontext.__gregs[REG_S2] = (greg_t) ucp->uc_link;
|
ucp->uc_mcontext.__gregs[REG_S2] = (greg_t) ucp->uc_link;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
FUNC(__start_context)
|
FUNC(libucontext_trampoline)
|
||||||
/* call the function passed to makecontext() */
|
/* call the function passed to makecontext() */
|
||||||
jalr s1
|
jalr s1
|
||||||
|
|
||||||
|
@ -26,4 +26,4 @@ FUNC(__start_context)
|
||||||
/* otherwise, exit. */
|
/* otherwise, exit. */
|
||||||
no_linked_context:
|
no_linked_context:
|
||||||
tail exit@plt
|
tail exit@plt
|
||||||
END(__start_context)
|
END(libucontext_trampoline)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
|
|
||||||
extern void __start_context(void);
|
extern void libucontext_trampoline(void);
|
||||||
extern int __setcontext(const ucontext_t *ucp);
|
extern int __setcontext(const ucontext_t *ucp);
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +38,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) &__setcontext;
|
||||||
ucp->uc_mcontext.gregs[14] = (uintptr_t) &__start_context;
|
ucp->uc_mcontext.gregs[14] = (uintptr_t) &libucontext_trampoline;
|
||||||
|
|
||||||
va_start(va, argc);
|
va_start(va, argc);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
FUNC(__start_context)
|
FUNC(libucontext_trampoline)
|
||||||
basr %r14, %r7 /* run function pointer (%r7) and return here */
|
basr %r14, %r7 /* run function pointer (%r7) and return here */
|
||||||
ltgr %r8, %r8 /* check to see if uc_link (%r8) is null */
|
ltgr %r8, %r8 /* check to see if uc_link (%r8) is null */
|
||||||
|
|
||||||
|
@ -26,4 +26,4 @@ no_linked_context:
|
||||||
brasl %r14, exit@plt /* call exit */
|
brasl %r14, exit@plt /* call exit */
|
||||||
|
|
||||||
j .+2 /* crash if exit returns */
|
j .+2 /* crash if exit returns */
|
||||||
END(__start_context)
|
END(libucontext_trampoline)
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
extern void __start_context(void);
|
extern void libucontext_trampoline(void);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -41,7 +41,7 @@ libucontext_makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||||
ucp->uc_mcontext.gregs[REG_ESP] = (uintptr_t) sp;
|
ucp->uc_mcontext.gregs[REG_ESP] = (uintptr_t) sp;
|
||||||
|
|
||||||
argp = sp;
|
argp = sp;
|
||||||
*argp++ = (uintptr_t) &__start_context;
|
*argp++ = (uintptr_t) &libucontext_trampoline;
|
||||||
|
|
||||||
va_start(va, argc);
|
va_start(va, argc);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
FUNC(__start_context)
|
FUNC(libucontext_trampoline)
|
||||||
/* get the proper context into position and test for NULL */
|
/* get the proper context into position and test for NULL */
|
||||||
leal (%esp,%ebx,4), %esp
|
leal (%esp,%ebx,4), %esp
|
||||||
cmpl $0, (%esp)
|
cmpl $0, (%esp)
|
||||||
|
@ -38,4 +38,4 @@ no_linked_context:
|
||||||
__i686.get_pc_thunk.bx:
|
__i686.get_pc_thunk.bx:
|
||||||
mov (%esp), %ebx
|
mov (%esp), %ebx
|
||||||
ret
|
ret
|
||||||
END(__start_context)
|
END(libucontext_trampoline)
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
extern void __start_context(void);
|
extern void libucontext_trampoline(void);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -40,7 +40,7 @@ libucontext_makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||||
ucp->uc_mcontext.gregs[REG_RBX] = (uintptr_t) &sp[uc_link];
|
ucp->uc_mcontext.gregs[REG_RBX] = (uintptr_t) &sp[uc_link];
|
||||||
ucp->uc_mcontext.gregs[REG_RSP] = (uintptr_t) sp;
|
ucp->uc_mcontext.gregs[REG_RSP] = (uintptr_t) sp;
|
||||||
|
|
||||||
sp[0] = (uintptr_t) &__start_context;
|
sp[0] = (uintptr_t) &libucontext_trampoline;
|
||||||
sp[uc_link] = (uintptr_t) ucp->uc_link;
|
sp[uc_link] = (uintptr_t) ucp->uc_link;
|
||||||
|
|
||||||
va_start(va, argc);
|
va_start(va, argc);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
FUNC(__start_context)
|
FUNC(libucontext_trampoline)
|
||||||
/* get the proper context into position and test for NULL */
|
/* get the proper context into position and test for NULL */
|
||||||
movq %rbx, %rsp
|
movq %rbx, %rsp
|
||||||
movq (%rsp), %rdi
|
movq (%rsp), %rdi
|
||||||
|
@ -31,4 +31,4 @@ no_linked_context:
|
||||||
|
|
||||||
/* something is really hosed, call hlt to force termination */
|
/* something is really hosed, call hlt to force termination */
|
||||||
hlt
|
hlt
|
||||||
END(__start_context)
|
END(libucontext_trampoline)
|
||||||
|
|
Loading…
Reference in New Issue