* [PATCH] x86 asm cleanups
@ 2001-05-29 20:48 Brian Gerst
0 siblings, 0 replies; only message in thread
From: Brian Gerst @ 2001-05-29 20:48 UTC (permalink / raw)
To: Alan Cox; +Cc: Linux kernel mailing list
[-- Attachment #1: Type: text/plain, Size: 197 bytes --]
This patch replaces several hardcoded .byte sequences with the proper
mnemonics or macros. I have tested this patch with the minimum required
binutils and current binutils.
--
Brian Gerst
[-- Attachment #2: diff-asm --]
[-- Type: text/plain, Size: 4311 bytes --]
diff -urN linux-2.4.5/arch/i386/boot/video.S linux/arch/i386/boot/video.S
--- linux-2.4.5/arch/i386/boot/video.S Sun Nov 21 03:09:51 1999
+++ linux/arch/i386/boot/video.S Tue May 29 15:13:35 2001
@@ -496,7 +496,7 @@
jnc setbad
addw %bx, %bx
- .word 0xa7ff, spec_inits # JMP [BX+spec_inits]
+ jmp *spec_inits(%bx)
setmenu:
orb %al, %al # 80x25 is an exception
@@ -1008,7 +1008,7 @@
vesa1:
# gas version 2.9.1, using BFD version 2.9.1.0.23 buggers the next inst.
# XXX: lodsw %gs:(%si), %ax # Get next mode in the list
- .byte 0x65, 0xAD # %gs seg prefix + lodsw
+ gs; lodsw
cmpw $0xffff, %ax # End of the table?
jz vesar
diff -urN linux-2.4.5/arch/i386/math-emu/reg_u_div.S linux/arch/i386/math-emu/reg_u_div.S
--- linux-2.4.5/arch/i386/math-emu/reg_u_div.S Sat Apr 28 11:11:46 2001
+++ linux/arch/i386/math-emu/reg_u_div.S Tue May 29 15:09:28 2001
@@ -89,10 +89,8 @@
movl REGB,%ebx
movl DEST,%edi
- movw EXP(%esi),%dx
- movw EXP(%ebx),%ax
- .byte 0x0f,0xbf,0xc0 /* movsx %ax,%eax */
- .byte 0x0f,0xbf,0xd2 /* movsx %dx,%edx */
+ movswl EXP(%esi),%edx
+ movswl EXP(%ebx),%eax
subl %eax,%edx
addl EXP_BIAS,%edx
diff -urN linux-2.4.5/drivers/char/random.c linux/drivers/char/random.c
--- linux-2.4.5/drivers/char/random.c Sat May 26 09:41:28 2001
+++ linux/drivers/char/random.c Tue May 29 15:09:28 2001
@@ -712,8 +712,7 @@
#if defined (__i386__)
if ( test_bit(X86_FEATURE_TSC, &boot_cpu_data.x86_capability) ) {
__u32 high;
- __asm__(".byte 0x0f,0x31"
- :"=a" (time), "=d" (high));
+ rdtsc(time, high);
num ^= high;
} else {
time = jiffies;
diff -urN linux-2.4.5/drivers/char/rocket.c linux/drivers/char/rocket.c
--- linux-2.4.5/drivers/char/rocket.c Sun Mar 25 21:24:31 2001
+++ linux/drivers/char/rocket.c Tue May 29 15:09:28 2001
@@ -485,14 +485,10 @@
unsigned char CtlMask, AiopMask;
#ifdef TIME_STAT
- unsigned long low=0, high=0, loop_time;
+ unsigned long loop_time;
unsigned long long time_stat_tmp=0, time_stat_tmp2=0;
- __asm__(".byte 0x0f,0x31"
- :"=a" (low), "=d" (high));
- time_stat_tmp = high;
- time_stat_tmp <<= 32;
- time_stat_tmp += low;
+ rdtscll(time_stat_tmp);
#endif /* TIME_STAT */
for (ctrl=0; ctrl < max_board; ctrl++) {
@@ -532,11 +528,7 @@
mod_timer(&rocket_timer, jiffies + 1);
}
#ifdef TIME_STAT
- __asm__(".byte 0x0f,0x31"
- :"=a" (low), "=d" (high));
- time_stat_tmp2 = high;
- time_stat_tmp2 <<= 32;
- time_stat_tmp2 += low;
+ rdtscll(time_stat_tmp2);
time_stat_tmp2 -= time_stat_tmp;
time_stat += time_stat_tmp2;
if (time_counter == 0)
diff -urN linux-2.4.5/drivers/net/hamradio/soundmodem/sm.h linux/drivers/net/hamradio/soundmodem/sm.h
--- linux-2.4.5/drivers/net/hamradio/soundmodem/sm.h Mon Dec 11 16:22:15 2000
+++ linux/drivers/net/hamradio/soundmodem/sm.h Tue May 29 15:09:28 2001
@@ -299,6 +299,8 @@
#ifdef __i386__
+#include <asm/msr.h>
+
/*
* only do 32bit cycle counter arithmetic; we hope we won't overflow.
* in fact, overflowing modems would require over 2THz CPU clock speeds :-)
@@ -307,10 +309,10 @@
#define time_exec(var,cmd) \
({ \
if (cpu_has_tsc) { \
- unsigned int cnt1, cnt2, cnt3; \
- __asm__(".byte 0x0f,0x31" : "=a" (cnt1), "=d" (cnt3)); \
+ unsigned int cnt1, cnt2; \
+ rdtscl(cnt1); \
cmd; \
- __asm__(".byte 0x0f,0x31" : "=a" (cnt2), "=d" (cnt3)); \
+ rdtscl(cnt2); \
var = cnt2-cnt1; \
} else { \
cmd; \
diff -urN linux-2.4.5/include/asm-i386/page.h linux/include/asm-i386/page.h
--- linux-2.4.5/include/asm-i386/page.h Sat May 26 10:56:53 2001
+++ linux/include/asm-i386/page.h Tue May 29 15:09:28 2001
@@ -88,7 +88,7 @@
*/
#define BUG() do { \
printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
- __asm__ __volatile__(".byte 0x0f,0x0b"); \
+ __asm__ __volatile__("ud2"); \
} while (0)
#define PAGE_BUG(page) do { \
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-05-29 20:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-29 20:48 [PATCH] x86 asm cleanups Brian Gerst
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox