From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9716 Path: news.gmane.org!not-for-mail From: Jaydeep Patil Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] Fix pthread_arch.h for microMIPS Date: Mon, 21 Mar 2016 10:01:02 +0000 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_BD7773622145634B952E5B54ACA8E349AA24ADD1PUMAIL01puimgte_" X-Trace: ger.gmane.org 1458554495 13417 80.91.229.3 (21 Mar 2016 10:01:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Mar 2016 10:01:35 +0000 (UTC) Cc: "musl@lists.openwall.com" , "nsz@port70.net" To: "dalias@libc.org" Original-X-From: musl-return-9729-gllmg-musl=m.gmane.org@lists.openwall.com Mon Mar 21 11:01:31 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ahweN-0003ua-SS for gllmg-musl@m.gmane.org; Mon, 21 Mar 2016 11:01:28 +0100 Original-Received: (qmail 30635 invoked by uid 550); 21 Mar 2016 10:01:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 30582 invoked from network); 21 Mar 2016 10:01:17 -0000 Thread-Topic: [PATCH] Fix pthread_arch.h for microMIPS Thread-Index: AdGDV7uQSvPB4JzRRjKIbR2yE1W+LA== Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.93.60] Xref: news.gmane.org gmane.linux.lib.musl.general:9716 Archived-At: --_000_BD7773622145634B952E5B54ACA8E349AA24ADD1PUMAIL01puimgte_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Rich, The patch fixes a link time error when compiled for microMIPS. The pthread_= self() function has been modified to use rdhwr instruction instead of .word= directive. The change has been done for both clang and gcc. Functions containing .word= are not compiled for microMIPS. Please refer to https://github.com/JaydeepIMG/musl-1/tree/fix_rdhwr_for_umi= ps for details. >From 09e4e395d9f1538edb548ffaa02db74e8e11701e Mon Sep 17 00:00:00 2001 From: Jaydeep Patil Date: Mon, 21 Mar 2016 09:53:37 +0000 Subject: [PATCH] Use rdhwr insn instead of .word for microMIPS --- arch/mips/pthread_arch.h | 10 ++-------- arch/mips64/pthread_arch.h | 9 ++------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/arch/mips/pthread_arch.h b/arch/mips/pthread_arch.h index 8a49965..30e2394 100644 --- a/arch/mips/pthread_arch.h +++ b/arch/mips/pthread_arch.h @@ -1,13 +1,7 @@ static inline struct pthread *__pthread_self() { -#ifdef __clang__ - char *tp; - __asm__ __volatile__ (".word 0x7c03e83b ; move %0, $3" : "=3Dr" (tp= ) : : "$3" ); -#else - register char *tp __asm__("$3"); - /* rdhwr $3,$29 */ - __asm__ __volatile__ (".word 0x7c03e83b" : "=3Dr" (tp) ); -#endif + register char *tp; + __asm__ __volatile__ ("rdhwr %0,$29" : "=3Dr" (tp)); return (pthread_t)(tp - 0x7000 - sizeof(struct pthread)); } diff --git a/arch/mips64/pthread_arch.h b/arch/mips64/pthread_arch.h index b42edbe..30e2394 100644 --- a/arch/mips64/pthread_arch.h +++ b/arch/mips64/pthread_arch.h @@ -1,12 +1,7 @@ static inline struct pthread *__pthread_self() { -#ifdef __clang__ - char *tp; - __asm__ __volatile__ (".word 0x7c03e83b ; move %0, $3" : "=3Dr" (tp= ) : : "$3" ); -#else - register char *tp __asm__("$3"); - __asm__ __volatile__ (".word 0x7c03e83b" : "=3Dr" (tp) ); -#endif + register char *tp; + __asm__ __volatile__ ("rdhwr %0,$29" : "=3Dr" (tp)); return (pthread_t)(tp - 0x7000 - sizeof(struct pthread)); } -- 2.1.4 Thanks, Jaydeep --_000_BD7773622145634B952E5B54ACA8E349AA24ADD1PUMAIL01puimgte_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi Rich,

 

The patch fixes a link time error when compiled for = microMIPS. The pthread_self() function has been modified to use rdhwr instr= uction instead of .word directive.

The change has been done for both clang and gcc. Fun= ctions containing .word are not compiled for microMIPS.

 

Please refer to https://github.com/JaydeepIMG/musl-1/tree/fix_rdhwr_for_umips for detai= ls.

 

 

 

From 09e4e395d9f1538edb548ffaa02db74e8e11701e Mon Se= p 17 00:00:00 2001

From: Jaydeep Patil <jaydeep.patil@imgtec.com>=

Date: Mon, 21 Mar 2016 09:53:37 +0000=

Subject: [PATCH] Use rdhwr insn instead of .word for= microMIPS

 

---

arch/mips/pthread_arch.h   | 10 ++= --------

arch/mips64/pthread_arch.h |  9 ++-----= --

2 files changed, 4 insertions(+), 15 deletions(-= )

 

diff --git a/arch/mips/pthread_arch.h b/arch/mips/pt= hread_arch.h

index 8a49965..30e2394 100644

--- a/arch/mips/pthread_arch.h

+++ b/arch/mips/pthread_arch.h

@@ -1,13 +1,7 @@

static inline struct pthread *__pthread_self()<= /o:p>

{

-#ifdef __clang__

-       char *tp;=

-       __asm__ __vola= tile__ (".word 0x7c03e83b ; move %0, $3" : "=3Dr" (tp) = : : "$3" );

-#else

-       register char = *tp __asm__("$3");

-       /* rdhwr $3,$2= 9 */

-       __asm__ __vola= tile__ (".word 0x7c03e83b" : "=3Dr" (tp) );<= /p>

-#endif

+       register c= har *tp;

+       __asm__ __= volatile__ ("rdhwr %0,$29" : "=3Dr" (tp));

        return (p= thread_t)(tp - 0x7000 - sizeof(struct pthread));

}

 

diff --git a/arch/mips64/pthread_arch.h b/arch/mips6= 4/pthread_arch.h

index b42edbe..30e2394 100644

--- a/arch/mips64/pthread_arch.h

+++ b/arch/mips64/pthread_arch.h

@@ -1,12 +1,7 @@

static inline struct pthread *__pthread_self()<= /o:p>

{

-#ifdef __clang__

-       char *tp;=

-       __asm__ __vola= tile__ (".word 0x7c03e83b ; move %0, $3" : "=3Dr" (tp) = : : "$3" );

-#else

-       register char = *tp __asm__("$3");

-       __asm__ __vola= tile__ (".word 0x7c03e83b" : "=3Dr" (tp) );<= /p>

-#endif

+       register c= har *tp;

+       __asm__ __= volatile__ ("rdhwr %0,$29" : "=3Dr" (tp));

        return (p= thread_t)(tp - 0x7000 - sizeof(struct pthread));

}

 

--

2.1.4

 

Thanks,

Jaydeep

 

--_000_BD7773622145634B952E5B54ACA8E349AA24ADD1PUMAIL01puimgte_--