Workaround for 2.1.11 modules

Andrew Lewycky (plewycky@oise.utoronto.ca)
Wed, 20 Nov 1996 17:54:05 -0500


Apologies if you've already seen the fix; I read linux-kernel off a
web page, and it seems to lag.

To fix modules, apply the patch (by David Miller?) that fixes the
checks on the return value from get_mod_name, and then apply this
patch.

What seems to be going on (at least on my system: gcc 2.7.2.1 with -O6)
is that gcc is allocating %eax for %0 in __strncpy_from_user, when %al
is already being used. I don't know if this is a gcc bug. However,
changing "=r" to "=bcd" results in gcc error messages (too many
reloads, etc.). The gcc bug is that %ebp is not being used. Is there
some way to explicitly allow %ebp in a register constraint?

In any case, this code works by forcing res into %eax, shifting count
up into the high 24 bits of %eax, and then shifting it down again.
This means you can't copy strings longer than 16M. Also, would
somebody be so kind as to take a look at gcc and see if
a) there are some optimisation bugs?
(I stared at gcc ouput to find this bug, and I saw some sick things.)
b) there is maybe some way to exclude a register in a constraint?

Andrew Lewycky

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d+ s-:- a--- C++++$ UL++++ P- L+++>++++ E W+ N++ o+ K w-- O-- M- V--
PS+ PE- Y+ PGP t+@ 5- X- R- tv- b++ DI+ D+(---) G e- h! r--- !y
------END GEEK CODE BLOCK------

--- linux/include/asm/uaccess.h Tue Nov 19 17:43:10 1996 +++ linux/include/asm/uaccess.h Wed Nov 20 17:21:03 1996 @@ -399,7 +399,8 @@ " jz 1f\n" \ " decl %1\n" \ " jnz 0b\n" \ - "1: subl %1,%0\n" \ + "1: shrl $8,%0\n" \ + " subl %1,%0\n" \ "2:\n" \ ".section .fixup,\"ax\"\n" \ "3: movl %2,%0\n" \ @@ -408,8 +409,8 @@ " .align 4\n" \ " .long 0b,3b\n" \ ".text" \ - : "=r"(res), "=r"(count) \ - : "i"(-EFAULT), "0"(count), "1"(count), "S"(src), "D"(dst) \ + : "=a"(res), "=r"(count) \ + : "i"(-EFAULT), "0"(count<<8), "1"(count), "S"(src), "D"(dst) \ : "si", "di", "ax", "memory") static inline long