Arjan,
I can experiment with any constraints if you suggest which one.
From our experiments with gcc, it compares asm strings (sic!!!) to find matches
to be merged! Sigh...
Below are 2 programs which differ in one space in read_cr3_b() asm statement.
The first one compiles incorrectly, while 2nd one - correctly.
My personal feeling is that comparing asm strings is simply a "misfeature".
-------------------------- cut ----------------------------
static inline unsigned long read_cr3_a(void)
{
unsigned long cr3;
asm("movq %%cr3,%0" : "=r" (cr3));
return cr3;
}
static inline unsigned long read_cr3_b(void)
{
unsigned long cr3;
asm("movq %%cr3,%0" : "=r" (cr3));
return cr3;
}
static inline void write_cr3(unsigned long val)
{
asm volatile("movq %0,%%cr3" :: "r" (val) : "memory");
}
void main()
{
unsigned long c;
c = read_cr3_a();
write_cr3(c | 0x80);
c = read_cr3_b();
write_cr3(c | 0x100);
}
-------------------------- cut ----------------------------
-------------------------- cut ----------------------------
static inline unsigned long read_cr3_a(void)
{
unsigned long cr3;
asm("movq %%cr3,%0" : "=r" (cr3));
return cr3;
}
static inline unsigned long read_cr3_b(void)
{
unsigned long cr3;
asm("movq %%cr3,%0" : "=r" (cr3));
return cr3;
}
static inline void write_cr3(unsigned long val)
{
asm volatile("movq %0,%%cr3" :: "r" (val) : "memory");
}
void main()
{
unsigned long c;
c = read_cr3_a();
write_cr3(c | 0x80);
c = read_cr3_b();
write_cr3(c | 0x100);
}
-------------------------- cut ----------------------------
Kirill
Arjan van de Ven wrote:
-
| Linus Torvalds | Linux 2.6.27-rc8 |
| Trent Piepho | [PATCH] [POWERPC] Improve (in|out)_beXX() asm code |
| Satyam Sharma | Re: 2.6.23-rc4-mm1 "no CRC" MODPOST warnings |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
git: | |
| Bill Lear | Dangers of working on a tracking branch |
| Jeff King | Re: What's cooking in git/spearce.git (topics) |
| Jason Garber | git push [rejected] question |
| Maxim Gordienko | [GIT-P4] usage under Windows |
| Richard Stallman | Real men don't attack straw men |
| Leon Dippenaar | New tcp stack attack |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Brandon Lee | DELL PERC 5iR slow performance |
| Jeff Garzik | Re: [PATCH] drivers/net: remove network drivers' last few uses of IRQF_SAMPLE_RANDOM |
| Paul Moore | [PATCH v7 00/17] Labeled networking patches for 2.6.28 |
| Denys Vlasenko | Re: bnx2 dirver's firmware images |
| Herbert Xu | Re: csum offload and af_packet |
