lkml.org 
[lkml]   [2003]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: asm (lidt) question
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.



- Davide

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.101 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site