public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Török Edwin" <edwintorok@gmail.com>
To: "Thomas Gleixner" <tglx@linutronix.de>,
	Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: inline asm semantics: output constraint width smaller than input
Date: Fri, 23 Jan 2009 19:57:20 +0200	[thread overview]
Message-ID: <497A0500.3080706@gmail.com> (raw)

Hi,

I am trying to build the kernel with LLVM 2.5 prerelease (using
llvm-gcc-4.2 frontend), however I am running into some inline asm
semantics issues, and after some discussion on LLVM bugzilla I would
like to know if you would be accepting patches for this:
http://llvm.org/bugs/show_bug.cgi?id=3373

The problem is when "a" output constraint is used with a variable of
smaller width than the
"0" input constraint.

Here are 2 examples:

int __ret_pu; unsigned long __pu_val;
return   ({asm volatile("call __put_user_" "8" : "=a" (__ret_pu) :"0"
                          (__pu_val), "c"(addr) : "ebx"); __ret_pu;});


unsigned char return_code;      /* %al */         
unsigned long address;          /* %ebx */ 
unsigned long length;           /* %ecx */
unsigned long entry;            /* %edx */
unsigned long flags;
__asm__("lcall *(%%edi); cld"
                : "=a" (return_code),
                  "=b" (address),
                  "=c" (length),
                  "=d" (entry)
                : "0" (service),
                  "1" (0),
                  "D" (&bios32_indirect));

There are 2 cases:
1. output is wider than input
2. output is narrower than input

Case 2 seems to occur lots of times on 64-bit (due to sizeof(int) != sizeof(unsigned long)), 
and a few times on 32-bit as well.

Would you accept patches that increase the portability of the inline asm statements? 
(essentially by adding casts for case 1, and introducing a temporary of correct width for case 2).

Please see: 
http://llvm.org/bugs/show_bug.cgi?id=3373#c6

Best regards,
--Edwin


             reply	other threads:[~2009-01-23 17:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-23 17:57 Török Edwin [this message]
2009-01-23 18:17 ` inline asm semantics: output constraint width smaller than input Ingo Molnar
2009-01-23 18:21   ` H. Peter Anvin
2009-01-23 18:27   ` Török Edwin
2009-01-23 18:30     ` Ingo Molnar
2009-01-23 18:52       ` Török Edwin
2009-01-23 20:42         ` Török Edwin
2009-01-24 16:23     ` Török Edwin
2009-01-24 17:27       ` Ingo Molnar
2009-01-24 18:57         ` Török Edwin
2009-01-24 21:25           ` [LLVMdev] " Mike Stump
2009-01-24 19:23         ` Chris Lattner
2009-01-24 21:10           ` H. Peter Anvin
2009-01-27 19:42         ` Duncan Sands
2009-01-27 21:25           ` H. Peter Anvin
2009-01-28  1:45             ` Kyle Moffett
2009-01-28  1:56               ` H. Peter Anvin
2009-01-28 13:28                 ` Kyle Moffett
2009-01-28 17:29                   ` H. Peter Anvin
2009-01-28 19:27                     ` Kyle Moffett
2009-01-28 20:59                       ` H. Peter Anvin
2009-01-24 20:07       ` Andreas Schwab

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=497A0500.3080706@gmail.com \
    --to=edwintorok@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox