From 1e45a1148f4d5a66357b71c630686c655f674cd6 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 20 Nov 2006 22:40:33 +0000 Subject: 2006-11-20 Samuel Thibault Asm tidy. * i386/i386/fpe_linkage.c (disable_fpe): Gather dependent asm statements, add `ax' clobber. (fpe_exception_fixup): Drop bogus cast from input parameter of lcall asm statement. * i386/i386/pio.h (inw, outw): Drop 0x66 prefix an just use the w instruction variant. * i386/i386/proc_reg.h: (get_eflags, get_tr, get_ldt): Drop useless "volatile" from asm statement. (get_esp): Use direct asm register specification. * i386/include/mach/i386/cthreads.h (cthread_sp): Likewise. * i386/intel/pmap.c (pmap_unmap_page_zero): Fix asm clobber into `eax'. De4x5 probe fixup. * linux/src/drivers/net/de4x5.c (pci_probe): Make probe loop stop on any error, not only device not found. --- i386/i386/fpe_linkage.c | 8 ++++---- i386/i386/pio.h | 4 ++-- i386/i386/proc_reg.h | 9 ++++----- i386/include/mach/i386/cthreads.h | 4 +--- i386/intel/pmap.c | 2 +- 5 files changed, 12 insertions(+), 15 deletions(-) (limited to 'i386') diff --git a/i386/i386/fpe_linkage.c b/i386/i386/fpe_linkage.c index 38860b0..f0ac34e 100644 --- a/i386/i386/fpe_linkage.c +++ b/i386/i386/fpe_linkage.c @@ -251,9 +251,9 @@ disable_fpe() * would reset fs & gs from the current user thread). */ - asm volatile("xorl %eax, %eax"); - asm volatile("movw %ax, %fs"); - asm volatile("movw %ax, %gs"); + asm volatile("xorw %ax, %ax\n\t" + "movw %ax, %fs\n\t" + "movw %ax, %gs\n\t":::"ax"); gdt_desc_p(cpu_number(), USER_FPREGS)->access &= ~ACC_P; } @@ -337,7 +337,7 @@ fpe_exception_fixup(exc, code, subcode) asm volatile("pushl %0; lcall %1; addl $4,%%esp" : : "r" (&tstate), - "m" (*(char *)&fpe_recover_ptr) ); + "m" (fpe_recover_ptr) ); (void) thread_setstatus(thread, i386_REGS_SEGS_STATE, diff --git a/i386/i386/pio.h b/i386/i386/pio.h index 3b22aee..f0e5e27 100644 --- a/i386/i386/pio.h +++ b/i386/i386/pio.h @@ -38,7 +38,7 @@ #define inw(y) \ ({ unsigned short _tmp__; \ - asm volatile(".byte 0x66; inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \ + asm volatile("inw %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \ _tmp__; }) #define inb(y) \ @@ -52,7 +52,7 @@ #define outw(x, y) \ -{asm volatile(".byte 0x66; outl %0, %1" : : "a" ((unsigned short)(y)) , "d" ((unsigned short)(x))); } +{ asm volatile("outw %0, %1" : : "a" ((unsigned short)(y)) , "d" ((unsigned short)(x))); } #define outb(x, y) \ diff --git a/i386/i386/proc_reg.h b/i386/i386/proc_reg.h index a8d2c09..5b9defd 100644 --- a/i386/i386/proc_reg.h +++ b/i386/i386/proc_reg.h @@ -52,7 +52,7 @@ static inline unsigned get_eflags() { unsigned eflags; - asm volatile("pushfd; popl %0" : "=r" (eflags)); + asm("pushfd; popl %0" : "=r" (eflags)); return eflags; } @@ -64,8 +64,7 @@ set_eflags(unsigned eflags) #define get_esp() \ ({ \ - register unsigned int _temp__; \ - asm("mov %%esp, %0" : "=r" (_temp__)); \ + register unsigned int _temp__ asm("esp"); \ _temp__; \ }) @@ -120,7 +119,7 @@ set_eflags(unsigned eflags) #define get_tr() \ ({ \ unsigned short _seg__; \ - asm volatile("str %0" : "=rm" (_seg__) ); \ + asm("str %0" : "=rm" (_seg__) ); \ _seg__; \ }) @@ -130,7 +129,7 @@ set_eflags(unsigned eflags) #define get_ldt() \ ({ \ unsigned short _seg__; \ - asm volatile("sldt %0" : "=rm" (_seg__) ); \ + asm("sldt %0" : "=rm" (_seg__) ); \ _seg__; \ }) diff --git a/i386/include/mach/i386/cthreads.h b/i386/include/mach/i386/cthreads.h index 62a29cb..e10cda3 100644 --- a/i386/include/mach/i386/cthreads.h +++ b/i386/include/mach/i386/cthreads.h @@ -48,9 +48,7 @@ typedef volatile int spin_lock_t; _r__; })) #define cthread_sp() \ - ({ int _sp__; \ - __asm__("movl %%esp, %0" \ - : "=g" (_sp__) ); \ + ({ register unsigned long _sp__ __asm__("esp"); \ _sp__; }) #endif /* __GNUC__ */ diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c index 8d99ad7..fef0d76 100644 --- a/i386/intel/pmap.c +++ b/i386/intel/pmap.c @@ -2427,6 +2427,6 @@ pmap_unmap_page_zero () pte = (int *) pmap_pte (kernel_pmap, 0); assert (pte); *pte = 0; - asm volatile ("movl %%cr3,%%eax; movl %%eax,%%cr3" ::: "ax"); + asm volatile ("movl %%cr3,%%eax; movl %%eax,%%cr3" ::: "eax"); } #endif /* i386 */ -- cgit v1.2.3