mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: asm (lidt) question
Date: Thu, 17 Jul 2003 16:31:03 -0700	[thread overview]
Message-ID: <20030717163103.40d4c96e.rddunlap@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.55.0307171615580.4845@bigblue.dev.mcafeelabs.com>

On Thu, 17 Jul 2003 16:18:06 -0700 (PDT) Davide Libenzi <davidel@xmailserver.org> wrote:

| On Thu, 17 Jul 2003, Davide Libenzi wrote:
| 
| > On Thu, 17 Jul 2003, Randy.Dunlap wrote:
| >
| > >
| > > In arch/i386/kernel, inline asm for loading IDT (lidt) is used a few
| > > times, but with slightly different constraints and output/input
| > > definitions.  Are these OK, equivalent, or what?
| > >
| > > [rddunlap@dragon kernel]$ findc lidt
| > > ./cpu/common.c:484: __asm__ __volatile__("lidt %0": "=m" (idt_descr));
| > > ./traps.c:783:	__asm__ __volatile__("lidt %0": "=m" (idt_descr));
| > >
| > > vs.
| > >
| > > ./reboot.c:186:	__asm__ __volatile__ ("lidt %0" : : "m" (real_mode_idt));
| > > ./reboot.c:261:	__asm__ __volatile__("lidt %0": :"m" (no_idt));
| > > ./suspend.c:95:	asm volatile ("lidt %0" :: "m" (saved_context.idt_limit));
| >
| > I'd have said no looking at the syntax (input/output), but they indeed
| > generate the same code (just checked).
| 
| Randy, I'd say that this :
| 
| __asm__ __volatile__("lidt %0": "=m" (var));
| 
| is better then :
| 
| __asm__ __volatile__("lidt %0": :"m" (var));
| 
| IMHO, since "var" is really an output parameter.

Yes, I agree, var is output and should be listed after the first ':'
IMHO also.

Thanks for checking that they generate the same code, though.

I'll buy you a beer...  No, wait, I already did that.  :)

--
~Randy

  reply	other threads:[~2003-07-17 23:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-17 22:28 Randy.Dunlap
2003-07-17 22:36 ` Davide Libenzi
2003-07-17 23:18   ` Davide Libenzi
2003-07-17 23:31     ` Randy.Dunlap [this message]
2003-07-17 23:36       ` Davide Libenzi
2003-07-22 17:27     ` Jamie Lokier
2003-07-22 17:31       ` Davide Libenzi
2003-07-22 17:50         ` Richard B. Johnson
2003-07-22 17:54           ` Davide Libenzi
2003-07-22 18:58         ` Randy.Dunlap
2003-07-22 18:58           ` Davide Libenzi
2003-07-22 19:04             ` Randy.Dunlap

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=20030717163103.40d4c96e.rddunlap@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=davidel@xmailserver.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®