Skip to content

Commit

Permalink
SH: Add CFI directives.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chung-Lin Tang authored and tschwinge committed May 27, 2012
1 parent 47e452c commit 65a4de4
Show file tree
Hide file tree
Showing 24 changed files with 420 additions and 33 deletions.
11 changes: 11 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2012-05-27 Chung-Lin Tang <[email protected]>

* sysdeps/sh/_mcount.S (_mount): Add CFI directives.
* sysdeps/unix/sh/sysdep.S (__syscall_error): Likewise.
* sysdeps/unix/sysv/linux/sh/sh3/setcontext.S (__setcontext): Likewise.
* sysdeps/unix/sysv/linux/sh/sh3/swapcontext.S (__swapcontext):
Likewise.
* sysdeps/unix/sysv/linux/sh/sh4/setcontext.S (__setcontext): Likewise.
* sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S (__swapcontext):
Likewise.

2012-05-27 Ulrich Drepper <[email protected]>

* po/h.po: Update from translation team.
Expand Down
33 changes: 33 additions & 0 deletions nptl/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
2012-05-27 Chung-Lin Tang <[email protected]>

* sysdeps/unix/sysv/linux/sh/lowlevellock.S (__lll_lock_wait_private)
(__lll_lock_wait, __lll_timedlock_wait, __lll_timedwait_tid): Add CFI
directives.
* sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S
(__lll_robust_lock_wait, __lll_robust_timedlock_wait): Likewise.
* sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S
(pthread_barrier_wait): Likewise.
* sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S
(__pthread_cond_broadcast): Likewise.
* sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S
(__pthread_cond_signal): Likewise.
* sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
(__pthread_cond_timedwait): Likewise.
* sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S (__pthread_cond_wait):
Likewise.
* sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S
(__pthread_rwlock_rdlock): Likewise.
* sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S
(pthread_rwlock_timedrdlock): Likewise.
* sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S
(pthread_rwlock_timedwrlock): Likewise.
* sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S
(__pthread_rwlock_unlock): Likewise.
* sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S
(__pthread_rwlock_wrlock): Likewise.
* sysdeps/unix/sysv/linux/sh/sem_post.S (__new_sem_post): Likewise.
* sysdeps/unix/sysv/linux/sh/sem_timedwait.S (sem_timedwait): Likewise.
* sysdeps/unix/sysv/linux/sh/sem_trywait.S (__new_sem_trywait):
Likewise.
* sysdeps/unix/sysv/linux/sh/sem_wait.S (__new_sem_wait): Likewise.

2012-05-26 Siddhesh Poyarekar <[email protected]>

[BZ #12416]
Expand Down
34 changes: 32 additions & 2 deletions nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ __lll_lock_wait_private:
bf 1b

mov.l @r15+, r8
cfi_adjust_cfa_offset (-4)
cfi_restore (r8)
rts
mov r2, r0
cfi_endproc
Expand Down Expand Up @@ -208,7 +210,11 @@ __lll_lock_wait:
bf 1b

mov.l @r15+, r8
cfi_adjust_cfa_offset (-4)
cfi_restore (r8)
mov.l @r15+, r9
cfi_adjust_cfa_offset (-4)
cfi_restore (r9)
ret
mov r2, r0
cfi_endproc
Expand Down Expand Up @@ -286,6 +292,7 @@ __lll_timedlock_wait:
5:
rts
mov.l @r15+, r12
/* Omit CFI for restore in delay slot. */

# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
.align 2
Expand All @@ -306,6 +313,8 @@ __lll_timedlock_wait:
cmp/hs r0, r1
bt 3f

cfi_remember_state

mov.l r11, @-r15
cfi_adjust_cfa_offset(4)
cfi_rel_offset (r11, 0)
Expand Down Expand Up @@ -386,17 +395,32 @@ __lll_timedlock_wait:
2: mov #ETIMEDOUT, r3

6:
mov r3, r0
add #8, r15
cfi_adjust_cfa_offset (-8)
mov.l @r15+, r8
cfi_adjust_cfa_offset (-4)
cfi_restore (r8)
mov.l @r15+, r9
cfi_adjust_cfa_offset (-4)
cfi_restore (r9)
mov.l @r15+, r10
cfi_adjust_cfa_offset (-4)
cfi_restore (r10)
mov.l @r15+, r11
cfi_adjust_cfa_offset (-4)
cfi_restore (r11)
mov.l @r15+, r12
cfi_adjust_cfa_offset (-4)
cfi_restore (r12)
rts
mov.l @r15+, r12
mov r3, r0

cfi_restore_state

3:
mov.l @r15+, r12
cfi_adjust_cfa_offset (-4)
cfi_restore (r12)
rts
mov #EINVAL, r0
# endif
Expand Down Expand Up @@ -521,10 +545,16 @@ __lll_timedwait_tid:
4:
mov #0, r0
3:
cfi_remember_state
add #8, r15
cfi_adjust_cfa_offset (-8)
mov.l @r15+, r8
cfi_adjust_cfa_offset (-4)
cfi_restore (r8)
rts
mov.l @r15+, r9
/* Omit CFI for restore in delay slot. */
cfi_restore_state
1:
/* Check whether the time expired. */
mov #-ETIMEDOUT, r1
Expand Down
21 changes: 19 additions & 2 deletions nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Copyright (C) 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
/* Copyright (C) 2003-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
Expand Down Expand Up @@ -115,6 +114,8 @@ __lll_robust_lock_wait:

3:
mov.l @r15+, r8
cfi_adjust_cfa_offset (-4)
cfi_restore (r8)
ret
mov r4, r0
cfi_endproc
Expand Down Expand Up @@ -231,12 +232,22 @@ __lll_robust_timedlock_wait:
mov #0, r0

6:
cfi_remember_state
add #8, r15
cfi_adjust_cfa_offset (-8)
mov.l @r15+, r8
cfi_adjust_cfa_offset (-4)
cfi_restore (r8)
mov.l @r15+, r9
cfi_adjust_cfa_offset (-4)
cfi_restore (r9)
mov.l @r15+, r10
cfi_adjust_cfa_offset (-4)
cfi_restore (r10)
rts
mov.l @r15+, r11
/* Omit CFI for restore in delay slot. */
cfi_restore_state

7:
/* Check whether the time expired. */
Expand All @@ -248,6 +259,12 @@ __lll_robust_timedlock_wait:
bra 6b
mov #ETIMEDOUT, r0
3:
/* Restore initial state for invalid timeout case. */
cfi_restore (r8)
cfi_restore (r9)
cfi_restore (r10)
cfi_restore (r11)
cfi_def_cfa_offset (0)
rts
mov #EINVAL, r0
cfi_endproc
Expand Down
34 changes: 29 additions & 5 deletions nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
/* Copyright (C) 2003-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
Expand All @@ -25,10 +25,17 @@
.globl pthread_barrier_wait
.type pthread_barrier_wait,@function
.align 5
cfi_startproc
pthread_barrier_wait:
mov.l r9, @-r15
cfi_adjust_cfa_offset (4)
cfi_rel_offset (r9, 0)
mov.l r8, @-r15
cfi_adjust_cfa_offset (4)
cfi_rel_offset (r8, 0)
sts.l pr, @-r15
cfi_adjust_cfa_offset (4)
cfi_rel_offset (pr, 0)
mov r4, r8

/* Get the mutex. */
Expand Down Expand Up @@ -98,11 +105,19 @@ pthread_barrier_wait:
bf 9f

10:
mov #0, r0 /* != PTHREAD_BARRIER_SERIAL_THREAD */
cfi_remember_state
lds.l @r15+, pr
cfi_adjust_cfa_offset (-4)
cfi_restore (pr)
mov.l @r15+, r8
cfi_adjust_cfa_offset (-4)
cfi_restore (r8)
mov.l @r15+, r9
cfi_adjust_cfa_offset (-4)
cfi_restore (r9)
rts
mov.l @r15+, r9
mov #0, r0 /* != PTHREAD_BARRIER_SERIAL_THREAD */
cfi_restore_state

3:
/* The necessary number of threads arrived. */
Expand Down Expand Up @@ -140,11 +155,19 @@ pthread_barrier_wait:
tst r2, r2
bf 4f
5:
mov #-1, r0 /* == PTHREAD_BARRIER_SERIAL_THREAD */
cfi_remember_state
lds.l @r15+, pr
cfi_adjust_cfa_offset (-4)
cfi_restore (pr)
mov.l @r15+, r8
cfi_adjust_cfa_offset (-4)
cfi_restore (r8)
mov.l @r15+, r9
cfi_adjust_cfa_offset (-4)
cfi_restore (r9)
rts
mov.l @r15+, r9
mov #-1, r0 /* == PTHREAD_BARRIER_SERIAL_THREAD */
cfi_restore_state

1:
mov.l @(PRIVATE,r8), r6
Expand Down Expand Up @@ -200,6 +223,7 @@ pthread_barrier_wait:
.Lwake2b:
bra 10b
mov r9, r6
cfi_endproc

.align 2
.Lall:
Expand Down
40 changes: 35 additions & 5 deletions nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
/* Copyright (C) 2003-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
Expand Down Expand Up @@ -30,11 +30,20 @@
.globl __pthread_cond_broadcast
.type __pthread_cond_broadcast, @function
.align 5
cfi_startproc
__pthread_cond_broadcast:
mov.l r10, @-r15
cfi_adjust_cfa_offset (4)
cfi_rel_offset (r10, 0)
mov.l r9, @-r15
cfi_adjust_cfa_offset (4)
cfi_rel_offset (r9, 0)
mov.l r8, @-r15
cfi_adjust_cfa_offset (4)
cfi_rel_offset (r8, 0)
sts.l pr, @-r15
cfi_adjust_cfa_offset (4)
cfi_rel_offset (pr, 0)
mov r4, r8

/* Get internal lock. */
Expand Down Expand Up @@ -136,12 +145,22 @@ __pthread_cond_broadcast:
add #cond_futex, r4

10:
mov #0, r0
cfi_remember_state
lds.l @r15+, pr
cfi_adjust_cfa_offset (-4)
cfi_restore (pr)
mov.l @r15+, r8
cfi_adjust_cfa_offset (-4)
cfi_restore (r8)
mov.l @r15+, r9
cfi_adjust_cfa_offset (-4)
cfi_restore (r9)
mov.l @r15+, r10
cfi_adjust_cfa_offset (-4)
cfi_restore (r10)
rts
mov.l @r15+, r10
mov #0, r0
cfi_restore_state

4:
/* Unlock. */
Expand All @@ -153,12 +172,22 @@ __pthread_cond_broadcast:
tst r2, r2
bf 5f
6:
mov #0, r0
cfi_remember_state
lds.l @r15+, pr
cfi_adjust_cfa_offset (-4)
cfi_restore (pr)
mov.l @r15+, r8
cfi_adjust_cfa_offset (-4)
cfi_restore (r8)
mov.l @r15+, r9
cfi_adjust_cfa_offset (-4)
cfi_restore (r9)
mov.l @r15+, r10
cfi_adjust_cfa_offset (-4)
cfi_restore (r10)
rts
mov.l @r15+, r10
mov #0, r0
cfi_restore_state

1:
/* Initial locking failed. */
Expand Down Expand Up @@ -244,6 +273,7 @@ __pthread_cond_broadcast:
SYSCALL_INST_PAD
bra 10b
nop
cfi_endproc

#ifndef __ASSUME_PRIVATE_FUTEX
.Lpfoff:
Expand Down
Loading

0 comments on commit 65a4de4

Please sign in to comment.