All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khalid Aziz <khalid.aziz@oracle.com>
To: sparclinux@vger.kernel.org
Subject: Please advise on dealing with compiler issue
Date: Wed, 20 Apr 2016 15:08:02 +0000	[thread overview]
Message-ID: <57179B52.5090200@oracle.com> (raw)

I am adding code to the sparc64 kernel that would require 
reading/writing one of the new registers on M7 processor, namely MCDPER. 
There are three ways I know of to do this:

1. __asm__ __volatile__("rd %%mcdper, %0\n\t": "=r" (tmp)) - This is the 
best way to do it but the support for %%mcdper is available in binutils 
2.26 and newer only. Compiling the kernel with older binutils will cause 
build failure.

2. __asm__ __volatile__("rd %%asr14, %0\n\t": "=r" (tmp)) - This should 
work independent of binutils version but it does not due to two bugs in 
assembler that have been fixed recently but not in a released version 
yet - <https://sourceware.org/ml/binutils/2016-03/msg00302.html>, 
<https://sourceware.org/ml/binutils/2016-03/msg00303.html>.

3. .byte 0x83,0x43,0x80,0x00 - This is byte coded equivalent of "rd 
%asr14, %g1". This works independent of binutils version but is ugly and 
requires pre-assigning a register to read MCDPER into, which does not 
help compiler with optimization.

Of the three options, only option 3 can work without requiring everyone 
compiling kernel to update to latest binutils.

Please advise on best way to proceed.

Thanks,
Khalid

             reply	other threads:[~2016-04-20 15:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-20 15:08 Khalid Aziz [this message]
2016-04-20 15:57 ` Please advise on dealing with compiler issue David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57179B52.5090200@oracle.com \
    --to=khalid.aziz@oracle.com \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.