1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

SH: makecontext: Improve understandability.

This commit is contained in:
Thomas Schwinge
2012-06-23 11:22:47 +02:00
parent d230f50a06
commit af1bce34ef
2 changed files with 34 additions and 29 deletions

View File

@ -1,3 +1,8 @@
2012-06-23 Thomas Schwinge <thomas@codesourcery.com>
* sysdeps/unix/sysv/linux/sh/makecontext.S: Add comments and give more
meaningful names to some local labels.
2012-06-22 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> 2012-06-22 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Kaz Kojima <kkojima@rr.iij4u.or.jp> Kaz Kojima <kkojima@rr.iij4u.or.jp>

View File

@ -1,5 +1,5 @@
/* Create new context. /* Create new context.
Copyright (C) 2005 Free Software Foundation, Inc. Copyright (C) 2005-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -33,44 +33,44 @@
.align 5 .align 5
ENTRY(__makecontext) ENTRY(__makecontext)
mov #4, r3 mov #4, r3
mov.l @(oSS_SP,r4), r1 mov.l @(oSS_SP,r4), r1 /* r1 <- ucb->stack_base */
mov.l @(oSS_SIZE,r4), r2 mov.l @(oSS_SIZE,r4), r2 /* r2 <- ucb->stack_size */
add r1, r2 add r1, r2 /* r2 <- stack_top */
cmp/gt r6, r3 cmp/gt r6, r3 /* 4 > argc? */
bf/s 1f bf/s 1f
shlr2 r2 shlr2 r2 /* r2 <- stack_top / 4 */
sub r6, r2 sub r6, r2
add r3, r2 add r3, r2
1: 1:
shll2 r2 shll2 r2 /* r2 <- stack_top - ((argc > 4) ? 4 * (argc - 4) : 0 */
mov #oR15, r0 mov #oR15, r0
mov.l @(oLINK,r4), r1 mov.l @(oLINK,r4), r1
mov.l r2, @(r0,r4) mov.l r2, @(r0,r4) /* ucp->r15 <- r2 */
mov.l r1, @(oR8,r4) mov.l r1, @(oR8,r4) /* ucp->r8 <- ucp->uc_link */
mov #oPC, r0 mov #oPC, r0
mov.l r5, @(r0,r4) mov.l r5, @(r0,r4) /* ucp->PC <- func */
cmp/pl r6 cmp/pl r6 /* argc > 0? */
bf/s .L1 bf/s .L1
dt r6 dt r6
mov.l r7, @(oR4,r4) mov.l r7, @(oR4,r4) /* ucp->r4 <- argv[0] */
cmp/pl r6 cmp/pl r6 /* argc > 1? */
bf/s .L1 bf/s .L1
dt r6 dt r6
mov.l @(0,r15), r1 mov.l @(0,r15), r1
mov.l r1, @(oR5,r4) mov.l r1, @(oR5,r4) /* ucp->r5 <- argv[1] */
cmp/pl r6 cmp/pl r6 /* argc > 2? */
bf/s .L1 bf/s .L1
dt r6 dt r6
mov.l @(4,r15), r1 mov.l @(4,r15), r1
mov.l r1, @(oR6,r4) mov.l r1, @(oR6,r4) /* ucp->r6 <- argv[2] */
cmp/pl r6 cmp/pl r6 /* argc > 3? */
bf/s .L1 bf/s .L1
dt r6 dt r6
mov.l @(8,r15), r1 mov.l @(8,r15), r1
mov.l r1, @(oR7,r4) mov.l r1, @(oR7,r4) /* ucp->r7 <- argv[3] */
mov #12,r0 mov #12,r0
.L0: .L0: /* Save remaining argv[] on the stack. */
cmp/pl r6 cmp/pl r6
bf/s .L1 bf/s .L1
dt r6 dt r6
@ -87,7 +87,7 @@ ENTRY(__makecontext)
#endif #endif
add #oPR, r4 add #oPR, r4
rts rts
mov.l r0, @r4 mov.l r0, @r4 /* ucp->pr <- exitcode */
#ifndef PIC #ifndef PIC
.align 2 .align 2
.L2: .L2:
@ -97,24 +97,24 @@ ENTRY(__makecontext)
.align 5 .align 5
.Lexitcode: .Lexitcode:
tst r8, r8 tst r8, r8 /* ucb->uc_link == NULL? */
bt/s 2f bt/s 2f
mov r8, r4 mov r8, r4 /* r4 <- ucb->uc_link */
#ifdef PIC #ifdef PIC
mova .Lgot, r0 mova .Lgot, r0
mov.l .Lgot, r12 mov.l .Lgot, r12
add r0, r12 add r0, r12
mov.l .L3, r1 mov.l .Lsetcontext, r1
bsrf r1 bsrf r1
.LPCS0: .LPCS0:
nop nop
#else #else
mov.l .L3, r1 mov.l .Lsetcontext, r1
jsr @r1 jsr @r1
nop nop
#endif #endif
2: 2:
mov.l .L4, r1 mov.l .Lexit, r1
#ifdef PIC #ifdef PIC
add r12, r1 add r12, r1
#endif #endif
@ -128,14 +128,14 @@ ENTRY(__makecontext)
#ifdef PIC #ifdef PIC
.Lgot: .Lgot:
.long _GLOBAL_OFFSET_TABLE_ .long _GLOBAL_OFFSET_TABLE_
.L3: .Lsetcontext:
.long __setcontext@PLT-(.LPCS0+2-(.)) .long __setcontext@PLT-(.LPCS0+2-(.))
.L4: .Lexit:
.long HIDDEN_JUMPTARGET(exit)@GOTOFF .long HIDDEN_JUMPTARGET(exit)@GOTOFF
#else #else
.L3: .Lsetcontext:
.long __setcontext .long __setcontext
.L4: .Lexit:
.long HIDDEN_JUMPTARGET(exit) .long HIDDEN_JUMPTARGET(exit)
#endif #endif
cfi_startproc cfi_startproc