[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Assembly code cleanups. gcc doesn't need very many hints to get the
ChangeSet 1.1584, 2005/05/28 12:00:01+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx Assembly code cleanups. gcc doesn't need very many hints to get the operand size and register names correct for both x86/32 and x86/64. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> arch/x86/flushtlb.c | 2 +- arch/x86/vmx_vmcs.c | 16 ++-------------- include/asm-x86/bitops.h | 4 ++-- include/asm-x86/flushtlb.h | 2 +- include/asm-x86/processor.h | 30 ++++++++++++++++-------------- include/asm-x86/rwlock.h | 12 ++++++------ 6 files changed, 28 insertions(+), 38 deletions(-) diff -Nru a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c --- a/xen/arch/x86/flushtlb.c 2005-05-28 08:01:53 -04:00 +++ b/xen/arch/x86/flushtlb.c 2005-05-28 08:01:53 -04:00 @@ -57,7 +57,7 @@ */ skip_clocktick: - __asm__ __volatile__ ( "mov"__OS" %0, %%cr3" : : "r" (cr3) : "memory" ); + __asm__ __volatile__ ( "mov %0, %%cr3" : : "r" (cr3) : "memory" ); /* * STEP 3. Update this CPU's timestamp. Note that this happens *after* diff -Nru a/xen/arch/x86/vmx_vmcs.c b/xen/arch/x86/vmx_vmcs.c --- a/xen/arch/x86/vmx_vmcs.c 2005-05-28 08:01:53 -04:00 +++ b/xen/arch/x86/vmx_vmcs.c 2005-05-28 08:01:53 -04:00 @@ -316,11 +316,7 @@ error |= __vmwrite(GUEST_EFLAGS, eflags); error |= __vmwrite(GUEST_INTERRUPTIBILITY_INFO, 0); -#ifdef __i386__ __asm__ __volatile__ ("mov %%dr7, %0\n" : "=r" (dr7)); -#else - __asm__ __volatile__ ("movq %%dr7, %0\n" : "=r" (dr7)); -#endif error |= __vmwrite(GUEST_DR7, dr7); error |= __vmwrite(GUEST_VMCS0, 0xffffffff); error |= __vmwrite(GUEST_VMCS1, 0xffffffff); @@ -356,21 +352,13 @@ host_env->idtr_base = desc.address; error |= __vmwrite(HOST_IDTR_BASE, host_env->idtr_base); -#ifdef __i386__ - __asm__ __volatile__ ("movl %%cr0,%0" : "=r" (crn) : ); -#else - __asm__ __volatile__ ("movq %%cr0,%0" : "=r" (crn) : ); -#endif + __asm__ __volatile__ ("mov %%cr0,%0" : "=r" (crn) : ); host_env->cr0 = crn; error |= __vmwrite(HOST_CR0, crn); /* same CR0 */ /* CR3 is set in vmx_final_setup_hostos */ -#ifdef __i386__ - __asm__ __volatile__ ("movl %%cr4,%0" : "=r" (crn) : ); -#else - __asm__ __volatile__ ("movq %%cr4,%0" : "=r" (crn) : ); -#endif + __asm__ __volatile__ ("mov %%cr4,%0" : "=r" (crn) : ); host_env->cr4 = crn; error |= __vmwrite(HOST_CR4, crn); error |= __vmwrite(HOST_EIP, (unsigned long) vmx_asm_vmexit_handler); diff -Nru a/xen/include/asm-x86/bitops.h b/xen/include/asm-x86/bitops.h --- a/xen/include/asm-x86/bitops.h 2005-05-28 08:01:53 -04:00 +++ b/xen/include/asm-x86/bitops.h 2005-05-28 08:01:53 -04:00 @@ -357,7 +357,7 @@ */ static __inline__ unsigned long find_first_clear_bit(unsigned long word) { - __asm__("bsf"__OS" %1,%0" + __asm__("bsf %1,%0" :"=r" (word) :"r" (~word)); return word; @@ -365,7 +365,7 @@ static __inline__ unsigned long find_first_set_bit(unsigned long word) { - __asm__("bsf"__OS" %1,%0" + __asm__("bsf %1,%0" :"=r" (word) :"r" (word)); return word; diff -Nru a/xen/include/asm-x86/flushtlb.h b/xen/include/asm-x86/flushtlb.h --- a/xen/include/asm-x86/flushtlb.h 2005-05-28 08:01:53 -04:00 +++ b/xen/include/asm-x86/flushtlb.h 2005-05-28 08:01:53 -04:00 @@ -70,7 +70,7 @@ { unsigned long cr3; __asm__ __volatile__ ( - "mov"__OS" %%cr3, %0" : "=r" (cr3) : ); + "mov %%cr3, %0" : "=r" (cr3) : ); return cr3; } diff -Nru a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h --- a/xen/include/asm-x86/processor.h 2005-05-28 08:01:53 -04:00 +++ b/xen/include/asm-x86/processor.h 2005-05-28 08:01:53 -04:00 @@ -255,24 +255,24 @@ #define read_cr0() ({ \ unsigned long __dummy; \ __asm__( \ - "mov"__OS" %%cr0,%0\n\t" \ + "mov %%cr0,%0\n\t" \ :"=r" (__dummy)); \ __dummy; \ }) #define write_cr0(x) \ - __asm__("mov"__OS" %0,%%cr0": :"r" ((unsigned long)x)); + __asm__("mov %0,%%cr0": :"r" ((unsigned long)x)); #define read_cr4() ({ \ unsigned long __dummy; \ __asm__( \ - "mov"__OS" %%cr4,%0\n\t" \ + "mov %%cr4,%0\n\t" \ :"=r" (__dummy)); \ __dummy; \ }) #define write_cr4(x) \ - __asm__("mov"__OS" %0,%%cr4": :"r" ((unsigned long)x)); + __asm__("mov %0,%%cr4": :"r" ((unsigned long)x)); /* * Save the cr4 feature set we're using (ie @@ -284,22 +284,24 @@ static inline void set_in_cr4 (unsigned long mask) { + unsigned long dummy; mmu_cr4_features |= mask; - __asm__("mov"__OS" %%cr4,%%"__OP"ax\n\t" - "or"__OS" %0,%%"__OP"ax\n\t" - "mov"__OS" %%"__OP"ax,%%cr4\n" - : : "irg" (mask) - :"ax"); + __asm__ __volatile__ ( + "mov %%cr4,%0\n\t" + "or %1,%0\n\t" + "mov %0,%%cr4\n" + : "=&r" (dummy) : "irg" (mask) ); } static inline void clear_in_cr4 (unsigned long mask) { + unsigned long dummy; mmu_cr4_features &= ~mask; - __asm__("mov"__OS" %%cr4,%%"__OP"ax\n\t" - "and"__OS" %0,%%"__OP"ax\n\t" - "mov"__OS" %%"__OP"ax,%%cr4\n" - : : "irg" (~mask) - :"ax"); + __asm__ __volatile__ ( + "mov %%cr4,%0\n\t" + "and %1,%0\n\t" + "mov %0,%%cr4\n" + : "=&r" (dummy) : "irg" (~mask) ); } /* diff -Nru a/xen/include/asm-x86/rwlock.h b/xen/include/asm-x86/rwlock.h --- a/xen/include/asm-x86/rwlock.h 2005-05-28 08:01:53 -04:00 +++ b/xen/include/asm-x86/rwlock.h 2005-05-28 08:01:53 -04:00 @@ -35,10 +35,10 @@ "js 2f\n" \ "1:\n" \ ".section .text.lock,\"ax\"\n" \ - "2:\tpush"__OS" %%"__OP"ax\n\t" \ - "lea"__OS" %0,%%"__OP"ax\n\t" \ + "2:\tpush %%"__OP"ax\n\t" \ + "lea %0,%%"__OP"ax\n\t" \ "call " helper "\n\t" \ - "pop"__OS" %%"__OP"ax\n\t" \ + "pop %%"__OP"ax\n\t" \ "jmp 1b\n" \ ".previous" \ :"=m" (*(volatile int *)rw) : : "memory") @@ -65,10 +65,10 @@ "jnz 2f\n" \ "1:\n" \ ".section .text.lock,\"ax\"\n" \ - "2:\tpush"__OS" %%"__OP"ax\n\t" \ - "lea"__OS" %0,%%"__OP"ax\n\t" \ + "2:\tpush %%"__OP"ax\n\t" \ + "lea %0,%%"__OP"ax\n\t" \ "call " helper "\n\t" \ - "pop"__OS" %%"__OP"ax\n\t" \ + "pop %%"__OP"ax\n\t" \ "jmp 1b\n" \ ".previous" \ :"=m" (*(volatile int *)rw) : : "memory") _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |