Google luky.org euqset.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH-RFC] arch/i386/kernel/: kill some sparse warnings



On Sun, 16 Jan 2005, Sam Ravnborg wrote:
> 
> loadsegment take the pointer to second argument and cast it to unsigned
> int *. Using a properly sized variable as argument to loadsegment kills
> this warning.

I think the bug here is in "loadsegment".

I don't really see why it uses "m" in the first place, since you can 
certainly move to a segment register from a reg too.

Afaik, that

	"m" (*(unsigned int *)&(value)))

is likely from some old bogus code for totally historical reasons, and it 
should likely just be

	"rm" (value)

instead.

Of course, there may be some strange mis-use of the thing somewhere which 
explains why the code does something that strange, and thus it might be 
best to check that all users are ok.

> For this fix I wonder what happened to the upper bits in the old
> implmentation - they were undefined per definition.

They are ignored by the definition of the instruction, and the 32-bit 
version (without a data size override) is selected just because it is 
faster. Which may be why it does that strange cast too: to make sure that 
the size of the operand matches (not that it should _matter_ for a memory 
op).

Oh, and the "%0" in the asm descriptor should probably have the operand 
character override for a full word, to make sure that the operand size 
(when we use a register - where it _does_ matter) matches the "movl". 

I think that means it should be "%k0" instead of "%0", ie something like

	"movl %k0,%%" #seg "\n"

for the move itself, along with the fix for the strange value thing.

Willing to see if that works ok?

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


$B$3$N>pJs$,$"$J$?$NC5$7$F$$?$b$N$+$I$&$+A*Br$7$F$/$@$5$!#(B
yes/$B$^$5$K$3$l$@!*(B   no/$B0c$&$J$!(B   part/$B0lIt8+$D$+$C$?(B   try/$B$3$l$G;n$7$F$_$k(B

$B$"$J$?$,C5$7$F$$?>pJs$O$I$N$h$&$J$3$H$+!"$4<+M3$K5-F~2<$5$!#FC$K!V$^$5$K$3$l$@!*!W$H8@$&>l9g$O5-F~$r$*4j$$7$^$9!#(B
$BNc(B:$B!VJ#?t$N%^%7%s$+$i(BCATV$B7PM3$G(Bipmasquerade$B$rMxMQ$7$F(BWeb$B$r;2>H$7$?$>l9g$N@_Dj$K$D$$F!W(B
References: