Compiler/Assembler warnings <patch>

Richard B. Johnson (root@chaos.analogic.com)
Wed, 15 Dec 1999 09:30:09 -0500 (EST)


The following patch is submitted again <sigh>. I wished I have saved
the previous one which never got into the kernel. Most of the stuff
is asm syntax errors where it is not possible to move a longword into
a short register so GAS fixes the code and issues a warning.

There are also some fixes to spinlock initialization for some SCSI
drivers.

--- linux-2.3.32/arch/i386/kernel/entry.S.orig Tue Dec 14 18:39:06 1999
+++ linux-2.3.32/arch/i386/kernel/entry.S Tue Dec 14 18:43:06 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; \
@@ -288,15 +288,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.32/arch/i386/kernel/head.S.orig Tue Dec 14 18:52:37 1999
+++ linux-2.3.32/arch/i386/kernel/head.S Tue Dec 14 18:57:25 1999
@@ -47,10 +47,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
@@ -231,13 +231,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
@@ -323,8 +323,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.32/arch/i386/kernel/process.c.orig Tue Dec 14 18:32:26 1999
+++ linux-2.3.32/arch/i386/kernel/process.c Tue Dec 14 18:34:02 1999
@@ -293,11 +293,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
--- linux-2.3.32/arch/i386/kernel/vm86.c.orig Wed Dec 15 08:47:40 1999
+++ linux-2.3.32/arch/i386/kernel/vm86.c Wed Dec 15 08:50:06 1999
@@ -260,7 +260,7 @@
mark_screen_rdonly(tsk);
unlock_kernel();
__asm__ __volatile__(
- "xorl %%eax,%%eax; movl %%ax,%%fs; movl %%ax,%%gs\n\t"
+ "xorl %%eax,%%eax; movl %%eax,%%fs; movl %%eax,%%gs\n\t"
"movl %0,%%esp\n\t"
"jmp ret_from_sys_call"
: /* no outputs */
--- linux-2.3.32/drivers/scsi/aic7xxx.c.orig Tue Dec 14 17:46:02 1999
+++ linux-2.3.32/drivers/scsi/aic7xxx.c Tue Dec 14 17:47:27 1999
@@ -1033,7 +1033,7 @@
unsigned long dev_expires[MAX_TARGETS];

#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,0)
- spinlock_t spin_lock;
+ spinlock_t spin_lock = SPIN_LOCK_UNLOCKED;
volatile unsigned char cpu_lock_count[NR_CPUS];
#endif

--- linux-2.3.32/drivers/scsi/ncr53c8xx.c.orig Tue Dec 14 17:49:56 1999
+++ linux-2.3.32/drivers/scsi/ncr53c8xx.c Tue Dec 14 17:51:05 1999
@@ -1692,7 +1692,7 @@
Scsi_Cmnd *done_list; /* Commands waiting for done() */
/* callback to be invoked. */
#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,93)
- spinlock_t smp_lock; /* Lock for SMP threading */
+ spinlock_t smp_lock = SPIN_LOCK_UNLOCKED; /* Lock for SMP threading */
#endif

/*----------------------------------------------------------------
--- linux-2.3.32/drivers/scsi/sym53c8xx.c.orig Tue Dec 14 17:53:01 1999
+++ linux-2.3.32/drivers/scsi/sym53c8xx.c Tue Dec 14 17:53:42 1999
@@ -1757,7 +1757,7 @@
Scsi_Cmnd *done_list; /* Commands waiting for done() */
/* callback to be invoked. */
#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,93)
- spinlock_t smp_lock; /* Lock for SMP threading */
+ spinlock_t smp_lock = SPIN_LOCK_UNLOCKED; /* Lock for SMP threading */
#endif

/*----------------------------------------------------------------
--- linux-2.3.32/include/asm-i386/hw_irq.h.orig Wed Dec 15 08:56:04 1999
+++ linux-2.3.32/include/asm-i386/hw_irq.h Wed Dec 15 09:00:02 1999
@@ -124,8 +124,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)

Cheers,
Dick Johnson

Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : The end of the world as we know it requires a new calendar.
Seconds : 1434591 (until Y2K)

-
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/