longword register asm errors with new binutils <Patch>

Richard B. Johnson (root@chaos.analogic.com)
Wed, 20 Oct 1999 15:52:28 -0400 (EDT)


The following fixes __most__ of the warning errors when compiling a
recent kernel with the latest binutils. I did not use a more recent
kernel because I haven't found one that works (honest). 2.3.13 is
the last one that works with my hardware.

The longwords remain as the natural size of the registers. Longwords
may correctly set segment registers on Intel machines and therefore
avoids the 0x66 prefix.

Anyways. This patch should work on anything new. There remain a few
other warnings and I haven't found out where they come from yet
because it's the result of the expansion of some macro somewhere.

--- linux-2.3.13/arch/i386/kernel/irq.h.orig Wed Oct 20 15:23:42 1999
+++ linux-2.3.13/arch/i386/kernel/irq.h Wed Oct 20 15:24:27 1999
@@ -168,8 +168,8 @@
"pushl %ecx\n\t" \
"pushl %ebx\n\t" \
"movl $" STR(__KERNEL_DS) ",%edx\n\t" \
- "movl %dx,%ds\n\t" \
- "movl %dx,%es\n\t"
+ "movl %edx,%ds\n\t" \
+ "movl %edx,%es\n\t"

#define IRQ_NAME2(nr) nr##_interrupt(void)
#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
--- linux-2.3.13/arch/i386/kernel/entry.S.orig Wed Oct 20 14:41:38 1999
+++ linux-2.3.13/arch/i386/kernel/entry.S Wed Oct 20 14:48:13 1999
@@ -92,8 +92,8 @@
pushl %ecx; \
pushl %ebx; \
movl $(__KERNEL_DS),%edx; \
- movl %dx,%ds; \
- movl %dx,%es;
+ movl %edx,%ds; \
+ movl %edx,%es;

#define RESTORE_ALL \
popl %ebx; \
@@ -262,15 +262,15 @@
pushl %ecx
pushl %ebx
cld
- movl %es,%cx
+ movl %es,%ecx
xchgl %eax, ORIG_EAX(%esp) # orig_eax (get the error code. )
movl %esp,%edx
xchgl %ecx, ES(%esp) # get the address and save es.
pushl %eax # push the error code
pushl %edx
movl $(__KERNEL_DS),%edx
- movl %dx,%ds
- movl %dx,%es
+ movl %edx,%ds
+ movl %edx,%es
GET_CURRENT(%ebx)
call *%ecx
addl $8,%esp
--- linux-2.3.13/arch/i386/kernel/head.S.orig Wed Oct 20 14:49:15 1999
+++ linux-2.3.13/arch/i386/kernel/head.S Wed Oct 20 14:51:52 1999
@@ -45,10 +45,10 @@
*/
cld
movl $(__KERNEL_DS),%eax
- movl %ax,%ds
- movl %ax,%es
- movl %ax,%fs
- movl %ax,%gs
+ movl %eax,%ds
+ movl %eax,%es
+ movl %eax,%fs
+ movl %eax,%gs
#ifdef __SMP__
orw %bx,%bx
jz 1f
@@ -229,13 +229,13 @@
lidt idt_descr
ljmp $(__KERNEL_CS),$1f
1: movl $(__KERNEL_DS),%eax # reload all the segment registers
- movl %ax,%ds # after changing gdt.
- movl %ax,%es
- movl %ax,%fs
- movl %ax,%gs
+ movl %eax,%ds # after changing gdt.
+ movl %eax,%es
+ movl %eax,%fs
+ movl %eax,%gs
#ifdef __SMP__
movl $(__KERNEL_DS), %eax
- mov %ax,%ss # Reload the stack pointer (segment only)
+ movl %eax,%ss # Reload the stack pointer (segment only)
#else
lss stack_start,%esp # Load processor stack
#endif
@@ -312,8 +312,8 @@
pushl %es
pushl %ds
movl $(__KERNEL_DS),%eax
- movl %ax,%ds
- movl %ax,%es
+ movl %eax,%ds
+ movl %eax,%es
pushl $int_msg
call SYMBOL_NAME(printk)
popl %eax
--- linux-2.3.13/arch/i386/kernel/process.c.orig Wed Oct 20 15:04:12 1999
+++ linux-2.3.13/arch/i386/kernel/process.c Wed Oct 20 15:05:18 1999
@@ -361,11 +361,11 @@
the values are consistent for real mode operation already. */

__asm__ __volatile__ ("movl $0x0010,%%eax\n"
- "\tmovl %%ax,%%ds\n"
- "\tmovl %%ax,%%es\n"
- "\tmovl %%ax,%%fs\n"
- "\tmovl %%ax,%%gs\n"
- "\tmovl %%ax,%%ss" : : : "eax");
+ "\tmovl %%eax,%%ds\n"
+ "\tmovl %%eax,%%es\n"
+ "\tmovl %%eax,%%fs\n"
+ "\tmovl %%eax,%%gs\n"
+ "\tmovl %%eax,%%ss" : : : "eax");

/* Jump to the 16-bit code that we copied earlier. It disables paging
and the cache, switches to real mode, and jumps to the BIOS reset

Cheers,
Dick Johnson

Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

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