Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaac3c30

Browse files
committed
Add s_lock support for SuperH architecture.
After a patch originally submitted by Nobuhiro Iwamatsu, but corrected(I think) to match our guidelines for safe use of asm fragments.This should be considered untested ...
1 parentcfbd2af commitaac3c30

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

‎src/include/storage/s_lock.h

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
6767
* Portions Copyright (c) 1994, Regents of the University of California
6868
*
69-
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.166 2009/01/01 17:24:01 momjian Exp $
69+
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.167 2009/07/27 05:31:05 tgl Exp $
7070
*
7171
*-------------------------------------------------------------------------
7272
*/
@@ -568,6 +568,36 @@ typedef int slock_t;
568568
#endif/* __m32r__ */
569569

570570

571+
#if defined(__sh__)/* Renesas' SuperH */
572+
#defineHAS_TEST_AND_SET
573+
574+
typedefunsignedcharslock_t;
575+
576+
#defineTAS(lock) tas(lock)
577+
578+
static __inline__int
579+
tas(volatileslock_t*lock)
580+
{
581+
registerint_res;
582+
583+
/*
584+
* This asm is coded as if %0 could be any register, but actually SuperH
585+
* restricts the target of xor-immediate to be R0. That's handled by
586+
* the "z" constraint on _res.
587+
*/
588+
__asm__ __volatile__(
589+
"tas.b @%2 \n"
590+
"movt %0 \n"
591+
"xor #1,%0 \n"
592+
:"=z"(_res),"+m"(*lock)
593+
:"r"(lock)
594+
:"memory","t");
595+
return_res;
596+
}
597+
598+
#endif/* __sh__ */
599+
600+
571601
/* These live in s_lock.c, but only for gcc */
572602

573603

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp