aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2012-06-23 11:22:47 +0200
committerThomas Schwinge <thomas@codesourcery.com>2012-06-23 11:22:47 +0200
commitaf1bce34ef3ae8caa84214175e93d809c11a5ea4 (patch)
treeb9fdd9c94ed89ca063d6b1e5b77372b391351eee
parentd230f50a0639b9bda8562fda3c905a964e371a38 (diff)
downloadglibc-af1bce34ef3ae8caa84214175e93d809c11a5ea4.tar
glibc-af1bce34ef3ae8caa84214175e93d809c11a5ea4.tar.gz
glibc-af1bce34ef3ae8caa84214175e93d809c11a5ea4.tar.bz2
glibc-af1bce34ef3ae8caa84214175e93d809c11a5ea4.zip
SH: makecontext: Improve understandability.
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/unix/sysv/linux/sh/makecontext.S58
2 files changed, 34 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index 455c3ccec8..3ebc2aba18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
Kaz Kojima <kkojima@rr.iij4u.or.jp>
diff --git a/sysdeps/unix/sysv/linux/sh/makecontext.S b/sysdeps/unix/sysv/linux/sh/makecontext.S
index 0a9e079545..9e1358dba6 100644
--- a/sysdeps/unix/sysv/linux/sh/makecontext.S
+++ b/sysdeps/unix/sysv/linux/sh/makecontext.S
@@ -1,5 +1,5 @@
/* 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.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,44 +33,44 @@
.align 5
ENTRY(__makecontext)
mov #4, r3
- mov.l @(oSS_SP,r4), r1
- mov.l @(oSS_SIZE,r4), r2
- add r1, r2
- cmp/gt r6, r3
+ mov.l @(oSS_SP,r4), r1 /* r1 <- ucb->stack_base */
+ mov.l @(oSS_SIZE,r4), r2 /* r2 <- ucb->stack_size */
+ add r1, r2 /* r2 <- stack_top */
+ cmp/gt r6, r3 /* 4 > argc? */
bf/s 1f
- shlr2 r2
+ shlr2 r2 /* r2 <- stack_top / 4 */
sub r6, r2
add r3, r2
1:
- shll2 r2
+ shll2 r2 /* r2 <- stack_top - ((argc > 4) ? 4 * (argc - 4) : 0 */
mov #oR15, r0
mov.l @(oLINK,r4), r1
- mov.l r2, @(r0,r4)
- mov.l r1, @(oR8,r4)
+ mov.l r2, @(r0,r4) /* ucp->r15 <- r2 */
+ mov.l r1, @(oR8,r4) /* ucp->r8 <- ucp->uc_link */
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
dt r6
- mov.l r7, @(oR4,r4)
- cmp/pl r6
+ mov.l r7, @(oR4,r4) /* ucp->r4 <- argv[0] */
+ cmp/pl r6 /* argc > 1? */
bf/s .L1
dt r6
mov.l @(0,r15), r1
- mov.l r1, @(oR5,r4)
- cmp/pl r6
+ mov.l r1, @(oR5,r4) /* ucp->r5 <- argv[1] */
+ cmp/pl r6 /* argc > 2? */
bf/s .L1
dt r6
mov.l @(4,r15), r1
- mov.l r1, @(oR6,r4)
- cmp/pl r6
+ mov.l r1, @(oR6,r4) /* ucp->r6 <- argv[2] */
+ cmp/pl r6 /* argc > 3? */
bf/s .L1
dt r6
mov.l @(8,r15), r1
- mov.l r1, @(oR7,r4)
+ mov.l r1, @(oR7,r4) /* ucp->r7 <- argv[3] */
mov #12,r0
-.L0:
+.L0: /* Save remaining argv[] on the stack. */
cmp/pl r6
bf/s .L1
dt r6
@@ -87,7 +87,7 @@ ENTRY(__makecontext)
#endif
add #oPR, r4
rts
- mov.l r0, @r4
+ mov.l r0, @r4 /* ucp->pr <- exitcode */
#ifndef PIC
.align 2
.L2:
@@ -97,24 +97,24 @@ ENTRY(__makecontext)
.align 5
.Lexitcode:
- tst r8, r8
+ tst r8, r8 /* ucb->uc_link == NULL? */
bt/s 2f
- mov r8, r4
+ mov r8, r4 /* r4 <- ucb->uc_link */
#ifdef PIC
mova .Lgot, r0
mov.l .Lgot, r12
add r0, r12
- mov.l .L3, r1
+ mov.l .Lsetcontext, r1
bsrf r1
.LPCS0:
nop
#else
- mov.l .L3, r1
+ mov.l .Lsetcontext, r1
jsr @r1
nop
#endif
2:
- mov.l .L4, r1
+ mov.l .Lexit, r1
#ifdef PIC
add r12, r1
#endif
@@ -128,14 +128,14 @@ ENTRY(__makecontext)
#ifdef PIC
.Lgot:
.long _GLOBAL_OFFSET_TABLE_
-.L3:
+.Lsetcontext:
.long __setcontext@PLT-(.LPCS0+2-(.))
-.L4:
+.Lexit:
.long HIDDEN_JUMPTARGET(exit)@GOTOFF
#else
-.L3:
+.Lsetcontext:
.long __setcontext
-.L4:
+.Lexit:
.long HIDDEN_JUMPTARGET(exit)
#endif
cfi_startproc