PATCH - burning the lighter

Martin Dalecki (dalecki@cs.net.pl)
Wed, 13 Oct 1999 04:11:13 +0200


This is a multi-part message in MIME format.
--------------379EE5693BB6EEC88B7CB511
Content-Type: text/plain; charset=iso-8859-2
Content-Transfer-Encoding: 7bit

Linus Torvalds wrote:
>
> On Tue, 12 Oct 1999, Martin Dalecki wrote:
>

OK I have been through objdump --disassemble -s by now and there are
actually no changes in the generated code. Catching cold is really
awsome boring somehow...
However the outb fix is obviously needed for compilation at all.
On same places the information about the clobbers wasn't quite
accurate. At all other places I'm just explicitly saying what
the assembler is actually telling in warnings, that it will do about the
code anyway.

Eje somehow a generall __asm__ audit of all the code wouldn't hurt.

--Marcin
--------------379EE5693BB6EEC88B7CB511
Content-Type: text/plain; charset=iso-8859-2;
name="asmfixes-2.3.21"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="asmfixes-2.3.21"

diff -ur linux/arch/i386/boot/bootsect.S linux-2.3.21/arch/i386/boot/bootsect.S
--- linux/arch/i386/boot/bootsect.S Tue Oct 12 22:46:57 1999
+++ linux-2.3.21/arch/i386/boot/bootsect.S Tue Oct 12 19:51:33 1999
@@ -401,7 +401,7 @@
pushw %dx
movw $0x3f2, %dx
xorb %al, %al
- outw %al, %dx
+ outb %al, %dx
popw %dx
ret

diff -ur linux/arch/i386/kernel/entry.S linux-2.3.21/arch/i386/kernel/entry.S
--- linux/arch/i386/kernel/entry.S Tue Oct 12 22:46:49 1999
+++ linux-2.3.21/arch/i386/kernel/entry.S Wed Oct 13 03:44:52 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; \
@@ -285,15 +285,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
diff -ur linux/arch/i386/kernel/head.S linux-2.3.21/arch/i386/kernel/head.S
--- linux/arch/i386/kernel/head.S Tue Oct 12 22:46:49 1999
+++ linux-2.3.21/arch/i386/kernel/head.S Wed Oct 13 03:01:40 1999
@@ -46,10 +46,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
@@ -230,13 +230,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
@@ -322,8 +322,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
diff -ur linux/arch/i386/kernel/process.c linux-2.3.21/arch/i386/kernel/process.c
--- linux/arch/i386/kernel/process.c Wed Aug 18 20:11:15 1999
+++ linux-2.3.21/arch/i386/kernel/process.c Wed Oct 13 03:45:09 1999
@@ -2,6 +2,10 @@
* linux/arch/i386/kernel/process.c
*
* Copyright (C) 1995 Linus Torvalds
+ *
+ * Tue Oct 12 1999 Marcin Dalecki <dalecki@cs.net.pl>:
+ * - Assembler ambiguity cleanup.
+ *
*/

/*
@@ -291,11 +295,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
@@ -424,7 +428,7 @@
void forget_segments(void)
{
/* forget local segments */
- __asm__ __volatile__("movl %w0,%%fs ; movl %w0,%%gs"
+ __asm__ __volatile__("movl %0,%%fs ; movl %0,%%gs"
: /* no outputs */
: "r" (0));

diff -ur linux/arch/i386/kernel/signal.c linux-2.3.21/arch/i386/kernel/signal.c
--- linux/arch/i386/kernel/signal.c Thu Jul 22 18:47:55 1999
+++ linux-2.3.21/arch/i386/kernel/signal.c Wed Oct 13 03:09:54 1999
@@ -339,9 +339,9 @@
int tmp, err = 0;

tmp = 0;
- __asm__("movl %%gs,%w0" : "=r"(tmp): "0"(tmp));
+ __asm__ __volatile__ ("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
err |= __put_user(tmp, (unsigned int *)&sc->gs);
- __asm__("movl %%fs,%w0" : "=r"(tmp): "0"(tmp));
+ __asm__ __volatile__ ("movl %%fs,%0" : "=r"(tmp): "0"(tmp));
err |= __put_user(tmp, (unsigned int *)&sc->fs);

err |= __put_user(regs->xes, (unsigned int *)&sc->es);
diff -ur linux/arch/i386/kernel/traps.c linux-2.3.21/arch/i386/kernel/traps.c
--- linux/arch/i386/kernel/traps.c Tue Oct 12 22:46:49 1999
+++ linux-2.3.21/arch/i386/kernel/traps.c Wed Oct 13 03:12:07 1999
@@ -660,7 +660,7 @@
((limit) & 0x0ffff); }

#define _set_tssldt_desc(n,addr,limit,type) \
-__asm__ __volatile__ ("movw %3,0(%2)\n\t" \
+__asm__ __volatile__ ("movw %w3,0(%2)\n\t" \
"movw %%ax,2(%2)\n\t" \
"rorl $16,%%eax\n\t" \
"movb %%al,4(%2)\n\t" \
diff -ur linux/arch/i386/kernel/vm86.c linux-2.3.21/arch/i386/kernel/vm86.c
--- linux/arch/i386/kernel/vm86.c Tue Jul 20 00:23:49 1999
+++ linux-2.3.21/arch/i386/kernel/vm86.c Wed Oct 13 03:14:24 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 */
diff -ur linux/include/asm-i386/hw_irq.h linux-2.3.21/include/asm-i386/hw_irq.h
--- linux/include/asm-i386/hw_irq.h Tue Oct 12 22:46:53 1999
+++ linux-2.3.21/include/asm-i386/hw_irq.h Wed Oct 13 03:15:14 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)
diff -ur linux/include/asm-i386/processor.h linux-2.3.21/include/asm-i386/processor.h
--- linux/include/asm-i386/processor.h Tue Oct 12 22:46:53 1999
+++ linux-2.3.21/include/asm-i386/processor.h Wed Oct 13 03:16:45 1999
@@ -2,6 +2,10 @@
* include/asm-i386/processor.h
*
* Copyright (C) 1994 Linus Torvalds
+ *
+ * Tue Oct 12 1999 Marcin Dalecki <dalecki@cs.net.pl>:
+ * - fixed obvious assembler glitches
+ *
*/

#ifndef __ASM_I386_PROCESSOR_H
@@ -158,7 +162,7 @@
"orl %0,%%eax\n\t"
"movl %%eax,%%cr4\n"
: : "irg" (mask)
- :"ax");
+ :"eax");
}

static inline void clear_in_cr4 (unsigned long mask)
@@ -168,7 +172,7 @@
"andl %0,%%eax\n\t"
"movl %%eax,%%cr4\n"
: : "irg" (~mask)
- :"ax");
+ :"eax");
}

/*
@@ -344,7 +348,7 @@
}

#define start_thread(regs, new_eip, new_esp) do { \
- __asm__("movl %w0,%%fs ; movl %w0,%%gs": :"r" (0)); \
+ __asm__ __volatile__ ("movl %0,%%fs ; movl %0,%%gs": :"r" (0)); \
set_fs(USER_DS); \
regs->xds = __USER_DS; \
regs->xes = __USER_DS; \

--------------379EE5693BB6EEC88B7CB511--

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