lkml.org 
[lkml]   [2000]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Clean up x86 write-protect test


On Fri, 13 Oct 2000, Brian Gerst wrote:
>
> Also, Could somebody who has a machine with a known buggy processor give
> this patch a try?

I like the patch. Would you mind re-writing the exception handling the
other way around, though:

Instead of doing it like this:

+ __asm__ __volatile__(
+ " movb %0,%1 \n"
+ "1: movb %1,%0 \n"
+ " jmp 3f \n"
+ "2: incl %2 \n"
+ "3: \n"
+ ".section __ex_table,\"a\"\n"
+ " .align 4 \n"
+ " .long 1b,2b \n"
+ ".previous \n"
+ :"=m" (*(char *) vaddr),
+ "=q" (tmp_reg),
+ "=r" (flag)
+ :"2" (flag)
+ :"memory");

it would be nicer to simply to the other way around (if exception happens,
"flag" is untouched and jumped over, if not, flag is cleared):

+ __asm__ __volatile__(
+ " movb %0,%1 \n"
+ "1: movb %1,%0 \n"
+ " xor %2,%2 \n"
+ "2: \n"
+ ".section __ex_table,\"a\"\n"
+ " .align 4 \n"
+ " .long 1b,2b \n"
+ ".previous \n"
+ :"=m" (*(char *) vaddr),
+ "=q" (tmp_reg),
+ "=r" (flag)
+ :"2" (1)
+ :"memory");

which basically means that if flag stays as "1", then the exception
happened, but if the exception didn't happen the code will fall through
the "xor" and clear "flag".

After that, and testing that it works on a broken machine, I'd love to
apply it.

Linus

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

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.036 / U:10.012 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site