mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
* sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c (__makecontext):
Cast sp to unsigned long to avoid compiler warning. Use __makecontext_ret function instead of a trampoline on the stack. (__makecontext_ret): New function. * sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c: Likewise.
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2006-09-20 Martin Schwidefsky <schwidefsky@de.ibm.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c (__makecontext):
|
||||||
|
Cast sp to unsigned long to avoid compiler warning.
|
||||||
|
Use __makecontext_ret function instead of a trampoline on the stack.
|
||||||
|
(__makecontext_ret): New function.
|
||||||
|
* sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c: Likewise.
|
||||||
|
|
||||||
2006-09-19 Jakub Jelinek <jakub@redhat.com>
|
2006-09-19 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* elf/dl-cache.c (HWCAP_CHECK): If _DL_PLATFORMS_COUNT, but
|
* elf/dl-cache.c (HWCAP_CHECK): If _DL_PLATFORMS_COUNT, but
|
||||||
|
@ -37,8 +37,6 @@
|
|||||||
+-----------------------+
|
+-----------------------+
|
||||||
n | overflow parameters | 96
|
n | overflow parameters | 96
|
||||||
+-----------------------+
|
+-----------------------+
|
||||||
8 | trampoline | 96+n
|
|
||||||
+-----------------------+
|
|
||||||
The registers are set up like this:
|
The registers are set up like this:
|
||||||
%r2-%r6: parameters 1 to 5
|
%r2-%r6: parameters 1 to 5
|
||||||
%r7 : (*func) pointer
|
%r7 : (*func) pointer
|
||||||
@ -55,18 +53,16 @@
|
|||||||
void
|
void
|
||||||
__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
|
__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
|
||||||
{
|
{
|
||||||
|
extern void __makecontext_ret (void);
|
||||||
unsigned long *sp;
|
unsigned long *sp;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sp = (long *) (((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & -8L);
|
sp = (unsigned long *) (((unsigned long) ucp->uc_stack.ss_sp
|
||||||
|
+ ucp->uc_stack.ss_size) & -8L);
|
||||||
/* Setup the trampoline. */
|
|
||||||
*--sp = 0x07f90000;
|
|
||||||
*--sp = 0x0de71828;
|
|
||||||
|
|
||||||
/* Set the return address to trampoline. */
|
/* Set the return address to trampoline. */
|
||||||
ucp->uc_mcontext.gregs[14] = (long) sp;
|
ucp->uc_mcontext.gregs[14] = (long) __makecontext_ret;
|
||||||
|
|
||||||
/* Set register parameters. */
|
/* Set register parameters. */
|
||||||
va_start (ap, argc);
|
va_start (ap, argc);
|
||||||
@ -98,4 +94,12 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
|
|||||||
ucp->uc_mcontext.gregs[15] = (long) sp;
|
ucp->uc_mcontext.gregs[15] = (long) sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asm(".text\n"
|
||||||
|
".type __makecontext_ret,@function\n"
|
||||||
|
"__makecontext_ret:\n"
|
||||||
|
" basr %r14,%r7\n"
|
||||||
|
" lr %r2,%r8\n"
|
||||||
|
" br %r9\n"
|
||||||
|
".size __makecontext_ret, .-__makecontext_ret");
|
||||||
|
|
||||||
weak_alias (__makecontext, makecontext)
|
weak_alias (__makecontext, makecontext)
|
||||||
|
@ -37,8 +37,6 @@
|
|||||||
+-----------------------+
|
+-----------------------+
|
||||||
n | overflow parameters | 160
|
n | overflow parameters | 160
|
||||||
+-----------------------+
|
+-----------------------+
|
||||||
8 | trampoline | 160+n
|
|
||||||
+-----------------------+
|
|
||||||
The registers are set up like this:
|
The registers are set up like this:
|
||||||
%r2-%r6: parameters 1 to 5
|
%r2-%r6: parameters 1 to 5
|
||||||
%r7 : (*func) pointer
|
%r7 : (*func) pointer
|
||||||
@ -55,17 +53,16 @@
|
|||||||
void
|
void
|
||||||
__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
|
__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
|
||||||
{
|
{
|
||||||
|
extern void __makecontext_ret (void);
|
||||||
unsigned long *sp;
|
unsigned long *sp;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sp = (long *) (((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & -8L);
|
sp = (unsigned long *) (((unsigned long) ucp->uc_stack.ss_sp
|
||||||
|
+ ucp->uc_stack.ss_size) & -8L);
|
||||||
/* Setup the trampoline. */
|
|
||||||
*--sp = 0x0de7b904002807f9;
|
|
||||||
|
|
||||||
/* Set the return address to trampoline. */
|
/* Set the return address to trampoline. */
|
||||||
ucp->uc_mcontext.gregs[14] = (long) sp;
|
ucp->uc_mcontext.gregs[14] = (long) __makecontext_ret;
|
||||||
|
|
||||||
/* Set register parameters. */
|
/* Set register parameters. */
|
||||||
va_start (ap, argc);
|
va_start (ap, argc);
|
||||||
@ -97,4 +94,12 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
|
|||||||
ucp->uc_mcontext.gregs[15] = (long) sp;
|
ucp->uc_mcontext.gregs[15] = (long) sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asm(".text\n"
|
||||||
|
".type __makecontext_ret,@function\n"
|
||||||
|
"__makecontext_ret:\n"
|
||||||
|
" basr %r14,%r7\n"
|
||||||
|
" lgr %r2,%r8\n"
|
||||||
|
" br %r9\n"
|
||||||
|
".size __makecontext_ret, .-__makecontext_ret");
|
||||||
|
|
||||||
weak_alias (__makecontext, makecontext)
|
weak_alias (__makecontext, makecontext)
|
||||||
|
Reference in New Issue
Block a user